File tree 4 files changed +7
-6
lines changed
bk2ch14p640systemSound/ch27p910systemSound
4 files changed +7
-6
lines changed Original file line number Diff line number Diff line change 2
2
3
3
#import < Foundation/Foundation.h>
4
4
5
- enum state {
5
+ enum State {
6
6
kDead ,
7
7
kAlive
8
8
};
9
+ typedef enum State State;
9
10
10
- void setState (enum state s);
11
+ void setState (State s);
11
12
12
13
@interface Thing : NSObject
13
14
Original file line number Diff line number Diff line change 2
2
3
3
#import " Thing.h"
4
4
5
- void setState (enum state s) {
5
+ void setState (State s) {
6
6
NSLog (@" %d " ,s);
7
7
}
8
8
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ class ViewController: UIViewController {
79
79
80
80
setState ( kDead)
81
81
setState ( kAlive)
82
- setState ( state ( rawValue: 2 ) ) // Swift can't stop you
82
+ setState ( State ( rawValue: 2 ) ) // Swift can't stop you
83
83
84
84
self . view. autoresizingMask = . FlexibleWidth
85
85
self . view. autoresizingMask = [ . FlexibleWidth, . FlexibleHeight]
@@ -163,13 +163,13 @@ class ViewController: UIViewController {
163
163
164
164
do {
165
165
func f ( s: String ) { print ( s) }
166
+ // let thing = f as! AnyObject // crash
166
167
let holder = StringExpecterHolder ( )
167
168
holder. f = f
168
169
let lay = CALayer ( )
169
170
lay. setValue ( holder, forKey: " myFunction " )
170
171
let holder2 = lay. valueForKey ( " myFunction " ) as! StringExpecterHolder
171
172
holder2. f ( " testing " )
172
-
173
173
}
174
174
175
175
}
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import AudioToolbox
5
5
6
6
// can be top level...
7
7
8
- func soundFinished( snd: SystemSoundID , _ context : UnsafeMutablePointer < Void > ) -> Void {
8
+ func soundFinished( snd: UInt32 , _ c : UnsafeMutablePointer < Void > ) -> Void {
9
9
print ( " finished! " )
10
10
AudioServicesRemoveSystemSoundCompletion ( snd)
11
11
AudioServicesDisposeSystemSoundID ( snd)
You can’t perform that action at this time.
0 commit comments