Skip to content

Commit 313171d

Browse files
authored
Merge pull request #14 from hyperoslo/fix/swift4
Update to swift 4
2 parents bc64abc + 8e9f19a commit 313171d

18 files changed

Lines changed: 492 additions & 53 deletions

File tree

.slather.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0
1+
4.0

.travis.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.

Keychains.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
Pod::Spec.new do |s|
22
s.name = "Keychains"
33
s.summary = "A keychain wrapper that is so easy to use that your cat could use it."
4-
s.version = "1.0.0"
4+
s.version = "2.0.0"
55
s.homepage = "https://github.com/hyperoslo/Keychains"
66
s.license = 'MIT'
77
s.author = { "Hyper Interaktiv AS" => "ios@hyper.no" }
88
s.source = { :git => "https://github.com/hyperoslo/Keychains.git", :tag => s.version.to_s }
99
s.social_media_url = 'https://twitter.com/hyperoslo'
1010

11-
s.ios.deployment_target = '8.0'
12-
s.osx.deployment_target = '10.9'
11+
s.ios.deployment_target = '9.0'
12+
s.osx.deployment_target = '10.10'
1313

1414
s.requires_arc = true
1515
s.ios.source_files = 'Source/{iOS,Shared}/**/*'

Keychains.xcodeproj/project.pbxproj

Lines changed: 181 additions & 15 deletions
Large diffs are not rendered by default.

Keychains.xcodeproj/xcshareddata/xcschemes/Keychain-iOS.xcscheme renamed to Keychains.xcodeproj/xcshareddata/xcschemes/Keychains-iOS.xcscheme

File renamed without changes.

Keychains.xcodeproj/xcshareddata/xcschemes/Keychain-Mac.xcscheme renamed to Keychains.xcodeproj/xcshareddata/xcschemes/Keychains-macOS.xcscheme

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
BuildableIdentifier = "primary"
1717
BlueprintIdentifier = "BDA447E11C294B45003FDEAD"
1818
BuildableName = "Keychains.framework"
19-
BlueprintName = "Keychains-Mac"
19+
BlueprintName = "Keychains-macOS"
2020
ReferencedContainer = "container:Keychains.xcodeproj">
2121
</BuildableReference>
2222
</BuildActionEntry>
@@ -34,8 +34,8 @@
3434
<BuildableReference
3535
BuildableIdentifier = "primary"
3636
BlueprintIdentifier = "BDA447EA1C294B45003FDEAD"
37-
BuildableName = "Tests-Mac.xctest"
38-
BlueprintName = "Tests-Mac"
37+
BuildableName = "Tests-macOS.xctest"
38+
BlueprintName = "Tests-macOS"
3939
ReferencedContainer = "container:Keychains.xcodeproj">
4040
</BuildableReference>
4141
</TestableReference>
@@ -45,7 +45,7 @@
4545
BuildableIdentifier = "primary"
4646
BlueprintIdentifier = "BDA447E11C294B45003FDEAD"
4747
BuildableName = "Keychains.framework"
48-
BlueprintName = "Keychains-Mac"
48+
BlueprintName = "Keychains-macOS"
4949
ReferencedContainer = "container:Keychains.xcodeproj">
5050
</BuildableReference>
5151
</MacroExpansion>
@@ -68,7 +68,7 @@
6868
BuildableIdentifier = "primary"
6969
BlueprintIdentifier = "BDA447E11C294B45003FDEAD"
7070
BuildableName = "Keychains.framework"
71-
BlueprintName = "Keychains-Mac"
71+
BlueprintName = "Keychains-macOS"
7272
ReferencedContainer = "container:Keychains.xcodeproj">
7373
</BuildableReference>
7474
</MacroExpansion>
@@ -86,7 +86,7 @@
8686
BuildableIdentifier = "primary"
8787
BlueprintIdentifier = "BDA447E11C294B45003FDEAD"
8888
BuildableName = "Keychains.framework"
89-
BlueprintName = "Keychains-Mac"
89+
BlueprintName = "Keychains-macOS"
9090
ReferencedContainer = "container:Keychains.xcodeproj">
9191
</BuildableReference>
9292
</MacroExpansion>

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Keychain
1+
# Keychains
22

3-
[![CI Status](http://img.shields.io/travis/hyperoslo/Keychain.svg?style=flat)](https://travis-ci.org/hyperoslo/Keychain)
4-
[![Version](https://img.shields.io/cocoapods/v/Keychain.svg?style=flat)](http://cocoadocs.org/docsets/Keychain)
3+
[![Version](https://img.shields.io/cocoapods/v/Keychains.svg?style=flat)](http://cocoadocs.org/docsets/Keychains)
54
[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
6-
[![License](https://img.shields.io/cocoapods/l/Keychain.svg?style=flat)](http://cocoadocs.org/docsets/Keychain)
7-
[![Platform](https://img.shields.io/cocoapods/p/Keychain.svg?style=flat)](http://cocoadocs.org/docsets/Keychain)
5+
[![License](https://img.shields.io/cocoapods/l/Keychains.svg?style=flat)](http://cocoadocs.org/docsets/Keychains)
6+
[![Platform](https://img.shields.io/cocoapods/p/Keychains.svg?style=flat)](http://cocoadocs.org/docsets/Keychains)
7+
![Swift](https://img.shields.io/badge/%20in-swift%204.0-orange.svg)
88

99
A keychain wrapper that is so easy to use that your cat could use it.
1010

@@ -23,18 +23,18 @@ Keychain.deletePassword(forAccount: account)
2323

2424
## Installation
2525

26-
**Keychain** is available through [CocoaPods](http://cocoapods.org). To install
26+
**Keychains** is available through [CocoaPods](http://cocoapods.org). To install
2727
it, simply add the following line to your Podfile:
2828

2929
```ruby
30-
pod 'Keychain'
30+
pod 'Keychains'
3131
```
3232

3333
**Keychain** is also available through [Carthage](https://github.com/Carthage/Carthage).
3434
To install just write into your Cartfile:
3535

3636
```ruby
37-
github "hyperoslo/Keychain"
37+
github "hyperoslo/Keychains"
3838
```
3939

4040
## Author
@@ -43,4 +43,4 @@ Hyper Interaktiv AS, ios@hyper.no
4343

4444
## License
4545

46-
**Keychain** is available under the MIT license. See the LICENSE file for more info.
46+
**Keychains** is available under the MIT license. See the LICENSE file for more info.

Source/Shared/Keychain.swift

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,12 @@ public struct Keychain {
3030
/// - service: The service, this is for kSecAttrService
3131
/// - accessGroup: The access group, this is for kSecAttrAccessGroup
3232
/// - Returns: The password
33-
public static func password(forAccount account: String, service: String = bundleIdentifier, accessGroup: String = "") -> String {
34-
guard !service.isEmpty && !account.isEmpty else { return "" }
33+
public static func password(forAccount account: String,
34+
service: String = bundleIdentifier,
35+
accessGroup: String = "") -> String? {
36+
guard !service.isEmpty && !account.isEmpty else {
37+
return nil
38+
}
3539

3640
var query = [
3741
kSecAttrAccount as String : account,
@@ -55,7 +59,9 @@ public struct Keychain {
5559
/// - accessGroup: The access group, this is for kSecAttrAccessGroup
5660
/// - Returns: True if the password can be set successfully
5761
@discardableResult public static func setPassword(_ password: String, forAccount account: String, service: String = bundleIdentifier, accessGroup: String = "") -> Bool {
58-
guard !service.isEmpty && !account.isEmpty else { return false }
62+
guard !service.isEmpty && !account.isEmpty else {
63+
return false
64+
}
5965

6066
var query = [
6167
kSecAttrAccount as String : account,
@@ -78,7 +84,9 @@ public struct Keychain {
7884
/// - service: The service, this is for kSecAttrService
7985
/// - Returns: True if the password can be safely deleted
8086
@discardableResult public static func deletePassword(forAccount account: String, service: String = bundleIdentifier, accessGroup: String = "") -> Bool {
81-
guard !service.isEmpty && !account.isEmpty else { return false }
87+
guard !service.isEmpty && !account.isEmpty else {
88+
return false
89+
}
8290

8391
var query = [
8492
kSecAttrAccount as String: account,

TestHost_iOS/AppDelegate.swift

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//
2+
// AppDelegate.swift
3+
// TestHost_iOS
4+
//
5+
// Created by Khoa Pham on 20.10.2017.
6+
// Copyright © 2017 Hyper Interaktiv AS. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
@UIApplicationMain
12+
class AppDelegate: UIResponder, UIApplicationDelegate {
13+
14+
var window: UIWindow?
15+
16+
17+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
18+
// Override point for customization after application launch.
19+
return true
20+
}
21+
22+
func applicationWillResignActive(_ application: UIApplication) {
23+
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
24+
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
25+
}
26+
27+
func applicationDidEnterBackground(_ application: UIApplication) {
28+
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
29+
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30+
}
31+
32+
func applicationWillEnterForeground(_ application: UIApplication) {
33+
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
34+
}
35+
36+
func applicationDidBecomeActive(_ application: UIApplication) {
37+
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
38+
}
39+
40+
func applicationWillTerminate(_ application: UIApplication) {
41+
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42+
}
43+
44+
45+
}
46+

0 commit comments

Comments
 (0)