Trouble reproducing a bug? Run this checklist to make sure you're reproducing user's environment as closely as possible:
Device
- iOS version?
- iPad/iPhone?
- CPU architecture?
- Screen size? Orientation? Slide-over/Split View?
iOS settings
// Dumb (and really slow) | |
import Foundation | |
func combinations(height: Int, _ level: Int) -> Int { | |
if (level == 1) { | |
return height + 1 | |
} else { | |
var sum = 0 | |
for i in 0...height { |
Trouble reproducing a bug? Run this checklist to make sure you're reproducing user's environment as closely as possible:
Device
iOS settings
// Option 1: if..elseif + optional unwrapping conditions | |
private func handleNotificationAction(id: String?, userInfo: [NSObject: AnyObject], responseInfo: [NSObject: AnyObject]?, completion: () -> Void) { | |
let taskId = userInfo["extra"]?["task_hash"] as? String | |
let projectId = userInfo["extra"]?["project_hash"] as? String | |
let comment = responseInfo?["UIUserNotificationActionResponseTypedTextKey"] as? String | |
if id == "comment", let task = taskId, comment = comment where !comment.isEmpty { | |
} else if id == "invitation_accept", let project = projectId { |
class Foo { | |
subscript(key: String) -> String { | |
get { a } | |
set { b } | |
} | |
subscript(key: String) -> String { | |
get { a } | |
set { b } | |
} |
class A { | |
subscript(key: B) -> C { | |
get { d } | |
set { e } | |
} | |
} |
class C { | |
let alias: Foo -> Void = f // error: Foo not a subtype of C | |
let alias2 = f // : C -> Foo -> Void | |
func f(arg: Foo) { | |
// ... | |
} | |
} |
# this doesn't do what you think it does | |
if f = foo && b = bar; end | |
# this works: | |
if (f = foo) && (b = bar); end | |
# and this works: | |
if f = foo and b = bar; end |
let data = error.userInfo![AFNetworkingOperationFailingURLResponseDataErrorKey] as NSData | |
consoleLog(NSString(data: data, encoding: NSUTF8StringEncoding)) |
Play Store | |
Books & Reference | |
Business | |
Comics | |
Communication | |
Education | |
Entertainment | |
Finance | |
Health & Fitness |