以 #selector 搭配 Xcode 幫我們完成的 function 名稱。

func playMusic(name:String) {}override func viewDidLoad() {    super.viewDidLoad()    let button = UIButton()    button.addTarget(self, action: #selector(ViewController.playMusic(name:)), for: .touchUpInside)}

彼得潘的iOS App程式設計入門,文組生的iOS App程式設計入門講師,彼得潘的 Swift 程式設計入門,App程式設計入門作者,http://apppeterpan.strikingly.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store