File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -142,6 +142,29 @@ Latest
142
142
143
143
For more information, see [ SE-0020] ( https://github.com/apple/swift-evolution/blob/master/proposals/0020-if-swift-version.md ) .
144
144
145
+ * The Objective-C selector of a Swift method can now be determined
146
+ directly with the #selector expression, e.g.,:
147
+
148
+ let sel = #selector(insertSubview(_:aboveSubview:)) // sel has type Selector
149
+
150
+ Along with this change, the use of string literals as selectors has
151
+ been deprecated, e.g.,
152
+
153
+ let sel: Selector = "insertSubview:aboveSubview:"
154
+
155
+ Generally, such string literals should be replaced with uses of
156
+ #selector, and the compiler will provide Fix-Its that use
157
+ #selector. In cases where they is not possible (e.g., when referring
158
+ to the getter of a property), one can still directly construct
159
+ selectors, e.g.,:
160
+
161
+ let sel = Selector("propertyName")
162
+
163
+ Note that the compiler is now checking the string literals used to
164
+ construct Selectors to ensure that they are well-formed Objective-C
165
+ selectors and that there is an '@objc ' method with that selector.
166
+
167
+
145
168
2015-09-17 [ Xcode 7.1, Swift 2.1]
146
169
----------
147
170
You can’t perform that action at this time.
0 commit comments