Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Discardable return values for set and remove methods. #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Simple-KeychainSwift/Classes/Keychain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import Foundation
// MARK: - *** Public methods ***
public class Keychain {

public class func set(_ value:String, forKey key:String) -> Bool {
@discardableResult public class func set(_ value:String, forKey key:String) -> Bool {
if valueExists(forKey: key) {
return update(value, forKey: key)
} else {
return create(value, forKey: key)
}
}

public class func set(_ bool:Bool, forKey key:String) -> Bool {
@discardableResult public class func set(_ bool:Bool, forKey key:String) -> Bool {
let value = bool ? "true" : "false"
return set(value, forKey: key)
}
Expand All @@ -34,7 +34,7 @@ public class Keychain {
return value(forKey: key) == "true"
}

public class func removeValue(forKey key:String) -> Bool {
@discardableResult public class func removeValue(forKey key:String) -> Bool {
return deleteValue(forKey: key)
}

Expand Down