Skip to content

Commit 481ecb6

Browse files
DougGregortkremenek
authored andcommitted
SE-0022: Add a changelog entry for #selector. It's done.
1 parent 113a242 commit 481ecb6

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,29 @@ Latest
142142

143143
For more information, see [SE-0020](https://github.com/apple/swift-evolution/blob/master/proposals/0020-if-swift-version.md).
144144

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+
145168
2015-09-17 [Xcode 7.1, Swift 2.1]
146169
----------
147170

0 commit comments

Comments
 (0)