@@ -11,7 +11,7 @@ struct State {
11
11
let abbrev : String
12
12
}
13
13
14
- func stateFromPlistLame( _ plist: Dictionary < String , AnyObject > ) -> State ? {
14
+ func stateFromPlistLame( _ plist: Dictionary < String , Any > ) -> State ? {
15
15
if let name = plist [ " name " ] as? NSString {
16
16
if let population = plist [ " population " ] as? NSNumber {
17
17
if let abbrev = plist [ " abbrev " ] as? NSString {
@@ -26,7 +26,7 @@ func stateFromPlistLame(_ plist: Dictionary<String, AnyObject>) -> State? {
26
26
return nil
27
27
}
28
28
29
- func stateFromPlistCool( _ plist: Dictionary < String , AnyObject > ) -> State ? {
29
+ func stateFromPlistCool( _ plist: Dictionary < String , Any > ) -> State ? {
30
30
switch ( plist [ " name " ] , plist [ " population " ] , plist [ " abbrev " ] ) {
31
31
case let ( name as String , pop as Int , abbr as String )
32
32
where abbr. characters. count == 2 :
@@ -38,22 +38,22 @@ func stateFromPlistCool(_ plist: Dictionary<String, AnyObject>) -> State? {
38
38
}
39
39
}
40
40
41
- let goodStatePlist : Dictionary < String , AnyObject > = [
42
- " name " : " California " ,
43
- " population " : 38_040_000 ,
44
- " abbrev " : " CA " ,
41
+ let goodStatePlist : Dictionary < String , Any > = [
42
+ " name " as String : " California " ,
43
+ " population " as String : 38_040_000 ,
44
+ " abbrev " as String : " CA " ,
45
45
]
46
- let invalidStatePlist1 : Dictionary < String , AnyObject > = [
46
+ let invalidStatePlist1 : Dictionary < String , Any > = [
47
47
" name " : " California " ,
48
48
" population " : " hella " ,
49
49
" abbrev " : " CA " ,
50
50
]
51
- let invalidStatePlist2 : Dictionary < String , AnyObject > = [
51
+ let invalidStatePlist2 : Dictionary < String , Any > = [
52
52
" name " : " California " ,
53
53
" population " : 38_040_000 ,
54
54
" abbrev " : " Cali " ,
55
55
]
56
- let invalidStatePlist3 : Dictionary < String , AnyObject > = [
56
+ let invalidStatePlist3 : Dictionary < String , Any > = [
57
57
" name " : " California " ,
58
58
" population " : 38_040_000 ,
59
59
]
@@ -102,7 +102,7 @@ enum Statistic : CustomReflectable {
102
102
}
103
103
}
104
104
105
- func statisticFromPlist( _ plist: Dictionary < String , AnyObject > ) -> Statistic ? {
105
+ func statisticFromPlist( _ plist: Dictionary < String , Any > ) -> Statistic ? {
106
106
switch ( plist [ " kind " ] , plist [ " name " ] , plist [ " population " ] , plist [ " abbrev " ] ) {
107
107
case let ( " state " as String , name as String , population as Int , abbrev as String )
108
108
where abbrev. characters. count == 2 :
@@ -117,29 +117,29 @@ func statisticFromPlist(_ plist: Dictionary<String, AnyObject>) -> Statistic? {
117
117
}
118
118
}
119
119
120
- let goodStatePlist2 : Dictionary < String , AnyObject > = [
120
+ let goodStatePlist2 : Dictionary < String , Any > = [
121
121
" kind " : " state " ,
122
122
" name " : " California " ,
123
123
" population " : 38_040_000 ,
124
124
" abbrev " : " CA "
125
125
]
126
- let goodCountryPlist : Dictionary < String , AnyObject > = [
126
+ let goodCountryPlist : Dictionary < String , Any > = [
127
127
" kind " : " country " ,
128
128
" name " : " India " ,
129
129
" population " : 1_23_70_00_000 ,
130
130
]
131
- let invalidCountryPlist1 : Dictionary < String , AnyObject > = [
131
+ let invalidCountryPlist1 : Dictionary < String , Any > = [
132
132
" kind " : " country " ,
133
133
" name " : " India " ,
134
134
" population " : 1_23_70_00_000 ,
135
135
" abbrev " : " IN "
136
136
]
137
- let invalidCountryPlist2 : Dictionary < String , AnyObject > = [
137
+ let invalidCountryPlist2 : Dictionary < String , Any > = [
138
138
" kind " : " country " ,
139
139
" name " : " India " ,
140
140
" population " : " 123 crore " ,
141
141
]
142
- let invalidKindPlist : Dictionary < String , AnyObject > = [
142
+ let invalidKindPlist : Dictionary < String , Any > = [
143
143
" kind " : " planet " ,
144
144
" name " : " Mercury " ,
145
145
" population " : 0
0 commit comments