Skip to content

Commit

Permalink
Merge pull request #376 from kishikawakatsumi/xcode9.3-swift4.1
Browse files Browse the repository at this point in the history
Xcode9.3 swift4.1
  • Loading branch information
kishikawakatsumi authored Apr 9, 2018
2 parents 3d89fe8 + 2eb78f1 commit b2233a8
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 22 deletions.
10 changes: 7 additions & 3 deletions Examples/Example-iOS/Example-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = "kishikawa katsumi";
TargetAttributes = {
14DAEE8F1A51E1BE0070B77E = {
Expand Down Expand Up @@ -272,12 +272,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
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_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -310,7 +312,7 @@
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.1;
};
name = Debug;
};
Expand All @@ -326,12 +328,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
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_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand All @@ -356,7 +360,7 @@
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.1;
VALIDATE_PRODUCT = YES;
};
name = Release;
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 = "0920"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -40,7 +40,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -70,7 +69,6 @@
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 KeychainAccess.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'KeychainAccess'
s.version = '3.1.0'
s.version = '3.1.1'
s.summary = 'KeychainAccess is a simple Swift wrapper for Keychain that works on iOS and OS X.'
s.description = <<-DESC
KeychainAccess is a simple Swift wrapper for Keychain that works on iOS and OS X.
Expand All @@ -26,7 +26,7 @@ Pod::Spec.new do |s|
s.requires_arc = true
s.source_files = 'Lib/KeychainAccess/*.swift'

s.pod_target_xcconfig = { 'SWIFT_VERSION' => '3.0' }
s.pod_target_xcconfig = { 'SWIFT_VERSION' => '4.1' }

s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.9'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
4 changes: 3 additions & 1 deletion Lib/Configurations/Base.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
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_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -44,4 +46,4 @@ WATCHOS_DEPLOYMENT_TARGET = 2.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
MACOSX_DEPLOYMENT_TARGET = 10.9;

SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.1;
1 change: 1 addition & 0 deletions Lib/Configurations/Release.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
MTL_ENABLE_DEBUG_INFO = NO;
VALIDATE_PRODUCT = YES;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = -Owholemodule;
2 changes: 1 addition & 1 deletion Lib/KeychainAccess.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0920;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = "kishikawa katsumi";
TargetAttributes = {
140F195B1A49D79400B0016A = {
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 = "0920"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down Expand Up @@ -40,7 +40,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -70,7 +69,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
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 = "0920"
LastUpgradeVersion = "0930"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
Expand All @@ -46,7 +45,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
2 changes: 1 addition & 1 deletion Lib/KeychainAccess/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.1.0</string>
<string>3.1.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
9 changes: 8 additions & 1 deletion Lib/KeychainAccess/Keychain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,14 @@ public final class Keychain {
}

public func allKeys() -> [String] {
return type(of: self).prettify(itemClass: itemClass, items: items()).flatMap { $0["key"] as? String }
let allItems = type(of: self).prettify(itemClass: itemClass, items: items())
let filter: ([String: Any]) -> String? = { $0["key"] as? String }

#if swift(>=4.1)
return allItems.compactMap(filter)
#else
return allItems.flatMap(filter)
#endif
}

public class func allItems(_ itemClass: ItemClass) -> [[String: Any]] {
Expand Down
36 changes: 33 additions & 3 deletions Lib/KeychainAccessTests/KeychainAccessTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -576,11 +576,21 @@ class KeychainAccessTests: XCTestCase {
XCTAssertNil(attributes?.ref)
XCTAssertNotNil(attributes?.persistentRef)
XCTAssertEqual(attributes?.accessible, Accessibility.afterFirstUnlock.rawValue)
if #available(iOS 9.0, *) {
#if os(iOS)
if #available(iOS 11.3, *) {
XCTAssertNotNil(attributes?.accessControl)
} else if #available(iOS 9.0, *) {
XCTAssertNil(attributes?.accessControl)
} else {
XCTAssertNotNil(attributes?.accessControl)
}
#else
if #available(tvOS 11.3, *) {
XCTAssertNotNil(attributes?.accessControl)
} else {
XCTAssertNil(attributes?.accessControl)
}
#endif
XCTAssertEqual(attributes?.accessGroup, "27AEDK3C9F.com.kishikawakatsumi.KeychainAccess.TestHost")
XCTAssertNotNil(attributes?.synchronizable)
XCTAssertNotNil(attributes?.creationDate)
Expand Down Expand Up @@ -618,11 +628,21 @@ class KeychainAccessTests: XCTestCase {
XCTAssertNil(attributes?.ref)
XCTAssertNotNil(attributes?.persistentRef)
XCTAssertEqual(attributes?.accessible, Accessibility.afterFirstUnlock.rawValue)
if #available(iOS 9.0, *) {
#if os(iOS)
if #available(iOS 11.3, *) {
XCTAssertNotNil(attributes?.accessControl)
} else if #available(iOS 9.0, *) {
XCTAssertNil(attributes?.accessControl)
} else {
XCTAssertNotNil(attributes?.accessControl)
}
#else
if #available(tvOS 11.3, *) {
XCTAssertNotNil(attributes?.accessControl)
} else {
XCTAssertNil(attributes?.accessControl)
}
#endif
XCTAssertEqual(attributes?.accessGroup, "27AEDK3C9F.com.kishikawakatsumi.KeychainAccess.TestHost")
XCTAssertNotNil(attributes?.synchronizable)
XCTAssertNotNil(attributes?.creationDate)
Expand Down Expand Up @@ -661,11 +681,21 @@ class KeychainAccessTests: XCTestCase {
XCTAssertNil(attributes?.ref)
XCTAssertNotNil(attributes?.persistentRef)
XCTAssertEqual(attributes?.accessible, Accessibility.afterFirstUnlock.rawValue)
if #available(iOS 9.0, *) {
#if os(iOS)
if #available(iOS 11.3, *) {
XCTAssertNotNil(attributes?.accessControl)
} else if #available(iOS 9.0, *) {
XCTAssertNil(attributes?.accessControl)
} else {
XCTAssertNotNil(attributes?.accessControl)
}
#else
if #available(tvOS 11.3, *) {
XCTAssertNotNil(attributes?.accessControl)
} else {
XCTAssertNil(attributes?.accessControl)
}
#endif
XCTAssertEqual(attributes?.accessGroup, "27AEDK3C9F.com.kishikawakatsumi.KeychainAccess.TestHost")
XCTAssertNotNil(attributes?.synchronizable)
XCTAssertNotNil(attributes?.creationDate)
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
[![Platform](https://img.shields.io/cocoapods/p/KeychainAccess.svg)](http://cocoadocs.org/docsets/KeychainAccess)
[![Swift 3.x](https://img.shields.io/badge/Swift-3.x-orange.svg?style=flat)](https://swift.org/)
[![Swift 4.0](https://img.shields.io/badge/Swift-4.0-orange.svg?style=flat)](https://swift.org/)
[![Swift 4.1](https://img.shields.io/badge/Swift-4.1-orange.svg?style=flat)](https://swift.org/)

KeychainAccess is a simple Swift wrapper for Keychain that works on iOS and OS X. Makes using Keychain APIs extremely easy and much more palatable to use in Swift.

Expand Down Expand Up @@ -539,7 +540,7 @@ item: [authenticationType: Default, key: honeylemon, server: github.com, class:
| **v2.3.x** | iOS 8+, OSX 10.9+, watchOS 2+, tvOS 9+ | 2.0, 2.1, 2.2 |
| **v2.4.x** | iOS 8+, OSX 10.9+, watchOS 2+, tvOS 9+ | 2.2, 2.3 |
| **v3.0.x** | iOS 8+, OSX 10.9+, watchOS 2+, tvOS 9+ | 3.x |
| **v3.1.x** | iOS 8+, OSX 10.9+, watchOS 2+, tvOS 9+ | 4.0 |
| **v3.1.x** | iOS 8+, OSX 10.9+, watchOS 2+, tvOS 9+ | 4.0, 4.1 |

## Installation

Expand Down

0 comments on commit b2233a8

Please sign in to comment.