diff --git a/pbxproj/pbxsections/XCLocalSwiftPackageReference.py b/pbxproj/pbxsections/XCLocalSwiftPackageReference.py new file mode 100644 index 0000000..d7cb8b6 --- /dev/null +++ b/pbxproj/pbxsections/XCLocalSwiftPackageReference.py @@ -0,0 +1,14 @@ +from pbxproj import PBXGenericObject + + +class XCLocalSwiftPackageReference(PBXGenericObject): + @classmethod + def create(cls, relative_path): + return cls().parse({ + '_id': cls._generate_id(), + 'isa': cls.__name__, + 'relativePath': relative_path + }) + + def _get_comment(self): + return f'XCLocalSwiftPackageReference "{self.relativePath}"' diff --git a/pbxproj/pbxsections/__init__.py b/pbxproj/pbxsections/__init__.py index 7139ba9..ac16691 100644 --- a/pbxproj/pbxsections/__init__.py +++ b/pbxproj/pbxsections/__init__.py @@ -18,3 +18,4 @@ from pbxproj.pbxsections.PBXGroup import * from pbxproj.pbxsections.XCSwiftPackageProductDependency import * from pbxproj.pbxsections.XCRemoteSwiftPackageReference import * +from pbxproj.pbxsections.XCLocalSwiftPackageReference import * diff --git a/tests/pbxsections/TestXCLocalSwiftPackageReference.py b/tests/pbxsections/TestXCLocalSwiftPackageReference.py new file mode 100644 index 0000000..c9eeb8c --- /dev/null +++ b/tests/pbxsections/TestXCLocalSwiftPackageReference.py @@ -0,0 +1,8 @@ +import unittest +from pbxproj.pbxsections.XCLocalSwiftPackageReference import * + + +class TestXCLocalSwiftPackageReference(unittest.TestCase): + def testGetComment(self): + obj = XCLocalSwiftPackageReference.create('MyPackage') + assert obj._get_comment() == 'XCLocalSwiftPackageReference "MyPackage"'