개발/swift

Swift UIControls with closures

lemonade 2020. 11. 12. 10:00
반응형

BRAND NEW FEATURE IN IOS 14

 


Following piece of code looks very familiar to iOS developer.

 

One difference in the above piece of code is that our method had a reference to the sender.

This could be handy in some cases when you want to know which of the controls in place called the linked method. 

Tired of using selector?

 


The same piece of code can now be written as follows:

 

 


Note that it is only available iOS 14+

From iOS 14, we can be free with @objc and #selector.

 

Happy coding :)

 

 

반응형
그리드형

'개발 > swift' 카테고리의 다른 글

Swift What is Enumeration?  (0) 2020.11.20
Swift UIColorPickerViewController  (0) 2020.11.14
Swift URLComponents  (0) 2020.11.12
Swift @available and #available  (0) 2020.11.10
Swift everything about launch screen  (0) 2020.11.07