Skip to content

Commit

Permalink
Update for latest Swift 2+
Browse files Browse the repository at this point in the history
Since this was written, we got optional chaining with `?` and `println` changed to `print`.
  • Loading branch information
tonyd256 authored and Tony DiPasquale committed Feb 12, 2016
1 parent 02d6d78 commit 8514a0a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions style/swift/sample.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ var maybe: Bool?

// Use if-let syntax to unwrap optionals
if let definitely = maybe {
println("This is \(definitely) here")
print("This is \(definitely) here")
}

// If the API you are using has implicit unwrapping you should still use if-let
func someUnauditedAPI(thing: String!) {
if let string = thing {
println(string)
print(string)
}
}

Expand All @@ -58,10 +58,10 @@ func doSomeWork() -> Response {

switch response {
case let .Success(data):
println("The response returned successfully \(data)")
print("The response returned successfully \(data)")

case let .Failure(error):
println("An error occured: \(error)")
print("An error occured: \(error)")
}

// Group methods into specific extensions for each level of access control
Expand Down

0 comments on commit 8514a0a

Please sign in to comment.