Swift - Cast Int into enum:Int

后端 未结 3 1921
悲&欢浪女
悲&欢浪女 2020-12-23 15:34

I am very new to Swift (got started this week) and I\'m migrating my app from Objective-C. I have basically the following code in Objective-C that works fine:



        
3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-23 16:06

    Swift 5

    @IBAction func selectFilter(sender: AnyObject) {
        timeFilterSelected = MyTimeFilter(rawValue: sender.tag)
     }
    

提交回复
热议问题