Skip to content

Commit

Permalink
Update phonebook example to use SPM
Browse files Browse the repository at this point in the history
  • Loading branch information
marmelroyspotify committed Sep 20, 2020
1 parent edbd0b4 commit 79ccb98
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 36 deletions.
1 change: 0 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ if [ "$MODE" = "examples" ]; then

for example in examples/*/; do
echo "Building $example."
pod install --project-directory=$example
xcodebuild \
-workspace "${example}Sample.xcworkspace" \
-scheme Sample \
Expand Down
14 changes: 0 additions & 14 deletions examples/PhoneBook/Podfile

This file was deleted.

68 changes: 56 additions & 12 deletions examples/PhoneBook/Sample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 52;
objects = {

/* Begin PBXBuildFile section */
Expand All @@ -16,6 +16,7 @@
347209751BB808D1004DE6DA /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 347209731BB808D1004DE6DA /* LaunchScreen.storyboard */; };
347209801BB808D1004DE6DA /* SampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3472097F1BB808D1004DE6DA /* SampleTests.swift */; };
3472098E1BB80A4F004DE6DA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3472098D1BB80A4F004DE6DA /* Foundation.framework */; };
34F26FD72517E51700B6AF4D /* PhoneNumberKit in Frameworks */ = {isa = PBXBuildFile; productRef = 34F26FD62517E51700B6AF4D /* PhoneNumberKit */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -63,6 +64,7 @@
buildActionMask = 2147483647;
files = (
344D875A1BDED6A600487684 /* ContactsUI.framework in Frameworks */,
34F26FD72517E51700B6AF4D /* PhoneNumberKit in Frameworks */,
344D87571BDED6A200487684 /* Contacts.framework in Frameworks */,
3472098E1BB80A4F004DE6DA /* Foundation.framework in Frameworks */,
);
Expand Down Expand Up @@ -138,6 +140,9 @@
dependencies = (
);
name = Sample;
packageProductDependencies = (
34F26FD62517E51700B6AF4D /* PhoneNumberKit */,
);
productName = Sample;
productReference = 347209671BB808D1004DE6DA /* Sample.app */;
productType = "com.apple.product-type.application";
Expand Down Expand Up @@ -166,7 +171,7 @@
3472095F1BB808D1004DE6DA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1000;
LastUpgradeCheck = 1200;
ORGANIZATIONNAME = "Roy Marmelstein";
TargetAttributes = {
347209661BB808D1004DE6DA = {
Expand All @@ -181,13 +186,16 @@
};
buildConfigurationList = 347209621BB808D1004DE6DA /* Build configuration list for PBXProject "Sample" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 3472095E1BB808D1004DE6DA;
packageReferences = (
34F26FD52517E51700B6AF4D /* XCRemoteSwiftPackageReference "PhoneNumberKit" */,
);
productRefGroup = 347209681BB808D1004DE6DA /* Products */;
projectDirPath = "";
projectRoot = "";
Expand Down Expand Up @@ -289,6 +297,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -313,13 +322,13 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "$(inherited)";
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -346,6 +355,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -364,12 +374,13 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_LDFLAGS = "$(inherited)";
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.2;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_VERSION = 5.0;
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand All @@ -381,7 +392,10 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = Sample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.Sample;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -395,7 +409,10 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = Sample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.Sample;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -411,7 +428,11 @@
"$(PROJECT_DIR)/Sample",
);
INFOPLIST_FILE = SampleTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.SampleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Sample.app/Sample";
Expand All @@ -427,7 +448,11 @@
"$(PROJECT_DIR)/Sample",
);
INFOPLIST_FILE = SampleTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.roymarmelstein.SampleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Sample.app/Sample";
Expand Down Expand Up @@ -465,6 +490,25 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
34F26FD52517E51700B6AF4D /* XCRemoteSwiftPackageReference "PhoneNumberKit" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/marmelroy/PhoneNumberKit.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 3.3.0;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
34F26FD62517E51700B6AF4D /* PhoneNumberKit */ = {
isa = XCSwiftPackageProductDependency;
package = 34F26FD52517E51700B6AF4D /* XCRemoteSwiftPackageReference "PhoneNumberKit" */;
productName = PhoneNumberKit;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 3472095F1BB808D1004DE6DA /* Project object */;
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"object": {
"pins": [
{
"package": "PhoneNumberKit",
"repositoryURL": "https://github.com/marmelroy/PhoneNumberKit.git",
"state": {
"branch": null,
"revision": "edbd0b43e914083c3b8af9403f64ac80f8270e47",
"version": "3.3.0"
}
}
]
},
"version": 1
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
LastUpgradeVersion = "1200"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -27,8 +27,6 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
Expand All @@ -38,8 +36,8 @@
ReferencedContainer = "container:Sample.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -61,8 +59,6 @@
ReferencedContainer = "container:Sample.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
2 changes: 1 addition & 1 deletion examples/PhoneBook/Sample/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ViewController: UIViewController, CNContactPickerDelegate {

func parseNumber(_ number: String) {
do {
let phoneNumber = try phoneNumberKit.parse(number)
let phoneNumber = try phoneNumberKit.parse(number, ignoreType: true)
self.parsedNumberLabel.text = self.phoneNumberKit.format(phoneNumber, toType: .international)
self.parsedCountryCodeLabel.text = String(phoneNumber.countryCode)
if let regionCode = phoneNumberKit.mainCountry(forCode: phoneNumber.countryCode) {
Expand Down

0 comments on commit 79ccb98

Please sign in to comment.