[swift-dev] [Swift 2.2] Request to merge code completion for #selector

Douglas Gregor dgregor at apple.com
Tue Feb 2 18:39:54 CST 2016


Hi Ted,

The #selector expression has both a discoverability and a usability problem due to fairly poor code completion. These two changes:

	https://github.com/apple/swift/commit/9736d54a771e87cc37be5c040404f6e387f766ec
	https://github.com/apple/swift/commit/f5cb1151c1ba4d8e40705ff31cb17c74c97daa4a

introduce much better code completion for #selector. The first commit makes

	#selector(<#@objc method#>)

an expression-specific (i.e., very high priority) completion when code-completing an argument for a parameter of type “ObjectiveC.Selector”, e.g.,

	obj.performSelector(<complete here and get #selector(<#@objc method#>)>

while the second provides compound-name completions for method references within a #selector subexpression, e.g.,

	#selector(NSObject.<complete here>

will give completions like

	performSelector(_:withObject:)

and

	init

and so on.


	- Doug



More information about the swift-dev mailing list