Skip to content

Commit

Permalink
Swift 4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Aug 26, 2017
1 parent 2a5e7e6 commit 74ce091
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 16 deletions.
21 changes: 16 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
os: osx
language: objective-c
osx_image: xcode8.3
matrix:
include:
- osx_image: xcode8.2
env: PLAT=iOS SWFT=3.0
- osx_image: xcode8.3
env: PLAT=iOS SWFT=3.1
- osx_image: xcode9
env: PLAT=iOS SWFT=3.2
- osx_image: xcode9
env: PLAT=iOS SWFT=4.0

before_install:
- export UUID=$(instruments -s | ruby -e "ARGF.each_line{ |ln| ln =~ /iPhone SE .* \[(.*)\]/; if \$1; puts(\$1); exit; end }");
- export UUID=$(instruments -s | ruby -e "ARGF.each_line{ |ln| ln =~ /iPhone SE .* \[(.*)\]/; if \$1; puts(\$1); exit; end }")

install:
- carthage bootstrap --platform iOS

script:
- set -o pipefail;
open -a "simulator" --args -CurrentDeviceUDID "$UUID";
xcodebuild -scheme PMKAddressBook -destination "id=$UUID" test | xcpretty
- set -o pipefail
- open -b com.apple.iphonesimulator --args -CurrentDeviceUDID "$UUID"
- xcodebuild -scheme PMKAddressBook -destination "id=$UUID" clean build SWIFT_VERSION=$SWFT
- xcodebuild -scheme PMKAddressBook -destination "id=$UUID" test
37 changes: 29 additions & 8 deletions PMKAddressBook.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
63C7FFA91D5BEE09003BAE60 /* Sources */,
63C7FFF31D5C020D003BAE60 /* Tests */,
63C7FFA81D5BEE09003BAE60 /* Products */,
63CCA1001F4D0D2A00423DDE /* Recovered References */,
);
sourceTree = "<group>";
};
Expand All @@ -72,17 +73,23 @@
children = (
63938C021D5C27AE00F4C165 /* ABAddressBookRequestAccess+Promise.swift */,
);
name = Sources;
path = "PMK+UIKit";
sourceTree = "<group>";
path = Sources;
sourceTree = SOURCE_ROOT;
};
63C7FFF31D5C020D003BAE60 /* Tests */ = {
isa = PBXGroup;
children = (
63938C081D5C27F600F4C165 /* TestAddressBook.swift */,
);
name = Tests;
path = PMKTests/NS;
path = Tests;
sourceTree = SOURCE_ROOT;
};
63CCA1001F4D0D2A00423DDE /* Recovered References */ = {
isa = PBXGroup;
children = (
63167B811D5C2332007A96B0 /* PMKAccountStore.h */,
);
name = "Recovered References";
sourceTree = "<group>";
};
/* End PBXGroup section */
Expand Down Expand Up @@ -140,17 +147,17 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0800;
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = "Max Howell";
TargetAttributes = {
63C7FFA61D5BEE09003BAE60 = {
CreatedOnToolsVersion = 8.0;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
ProvisioningStyle = Automatic;
};
63C7FFF11D5C020D003BAE60 = {
CreatedOnToolsVersion = 8.0;
LastSwiftMigration = 0800;
LastSwiftMigration = 0900;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -229,15 +236,22 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -287,15 +301,22 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_SUSPICIOUS_MOVES = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -55,6 +56,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
4 changes: 2 additions & 2 deletions Sources/ABAddressBookRequestAccess+Promise.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ extension NSError {
fileprivate convenience init(CFError error: CoreFoundation.CFError) {
let domain = CFErrorGetDomain(error) as String
let code = CFErrorGetCode(error)
let info = CFErrorCopyUserInfo(error) as [NSObject: AnyObject]
let info = CFErrorCopyUserInfo(error) as? [String: Any] ?? [:]
self.init(domain: domain, code: code, userInfo: info)
}
}
Expand All @@ -95,7 +95,7 @@ private func ABAddressBookRequestAccess() -> Promise<(Bool, ABAddressBook)> {
if let error = error {
reject(NSError(CFError: error))
} else {
fulfill(granted, book)
fulfill((granted, book))
}
}
}
Expand Down

0 comments on commit 74ce091

Please sign in to comment.