-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate codebase to Swift 3.0 #345
Conversation
Changed router to class as can’t reference mutating structs in closure Refactored Range<Int> to CountableClosedRange<Int> Some ugly explicit bridging Change func option(…) to withOptions(…) in Lock.Swift
Removed test code
didSet { | ||
self.iconView?.tintColor = self.titleColor | ||
self.button?.setTitleColor(self.titleColor, forState: .Normal) | ||
self.button?.setTitleColor(self.titleColor, for: UIControlState()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use []
guard case .Big = self.size else { return } | ||
self.button?.setTitle(self.title, forState: .Normal) | ||
guard case .big = self.size else { return } | ||
self.button?.setTitle(self.title, for: UIControlState()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use []
|
||
public init(size: Size) { | ||
self.size = size | ||
super.init(frame: CGRectZero) | ||
super.init(frame: CGRect.zero) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just .zero
will do
self.logger.error("Response was not NSHTTURLResponse") | ||
return callback(nil) | ||
} | ||
|
||
let payload: String? | ||
if let data = data { | ||
payload = String(data: data, encoding: NSUTF8StringEncoding) | ||
payload = String(data: data, encoding: String.Encoding.utf8) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just .utf8
} | ||
} | ||
} | ||
|
||
private mutating func updateEmail(value: String?) -> ErrorType? { | ||
self.user.email = value?.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()) | ||
private mutating func updateEmail(_ value: String?) -> Error? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will be more swifter to use update(email: String?) -> Error?
let error = self.emailValidator.validate(value) | ||
self.user.validEmail = error == nil | ||
return error | ||
} | ||
|
||
private mutating func updateUsername(value: String?) -> ErrorType? { | ||
self.user.username = value?.stringByTrimmingCharactersInSet(NSCharacterSet.whitespaceAndNewlineCharacterSet()) | ||
private mutating func updateUsername(_ value: String?) -> Error? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will be more swifter to use update(username: String?) -> Error?
let error = self.usernameValidator.validate(value) | ||
self.user.validUsername = error == nil | ||
return error | ||
} | ||
|
||
private mutating func updatePassword(value: String?) -> ErrorType? { | ||
private mutating func updatePassword(_ value: String?) -> Error? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will be more swifter to use update(password: String?) -> Error?
self.user.password = value | ||
let error = self.passwordValidator.validate(value) | ||
self.user.validPassword = error == nil | ||
return error | ||
} | ||
|
||
private func handleLoginResult(result: Auth0.Result<Credentials>, callback: DatabaseAuthenticatableError? -> ()) { | ||
private func handleLoginResult(_ result: Auth0.Result<Credentials>, callback: (DatabaseAuthenticatableError?) -> ()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here just use handle(result: Auth0.Result<Credentials>, callback: (DatabaseAuthenticatableError?) -> (
Don’t suppress Lock returns
No description provided.