-
Notifications
You must be signed in to change notification settings - Fork 47
/
Thoughts-Questions.txt
24 lines (21 loc) · 1.31 KB
/
Thoughts-Questions.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Swift Thoughts and Questions
- How do you get pretty printing of instances in the playground?
- Could you get a pretty printout of something like a 2D matrix?
- How does Phase two of object initialization work?
- In the Deinitialization Chapter is the Bank object (that only contains Type properties and methods) a hacky way of having a singleton?
- The Player deinitialization method doesn't get called in the playground when the playerOne variable is set to nil.
In "Using Swift with Cocoa and Objective-C"
- let myTextField = UITextField(frame: CGRect(0.0, 0.0, 200.0, 40.0)) is corrected by the playground autocorrecto to let myTextField = UITextField(frame: CGRect(x: 0.0, y: 0.0, width: 200.0, height: 40.0))
- myTextField.editing = false is reported as an error as editing is not allowed to be assigned.
- The following doesn't seem to work in a playground
let myLength = myObject.length?
if let fifthCharacter = myObject.characterAtIndex(5) {
println("Found \(fifthCharacter) at index 5")
}
- let squareRoot = Float(sqrt(3)) gives an "Ambiguous use of sqrt in Beta 3". It doesn't look like you can call sqrt() on an integer.
- The following code gives a error in the playground no matter what object and UIButton are.
if object is UIButton {
// object is of type UIButton
} else {
// object is not of type UIButton
}