I am updating my app from Swift 3 to Swift 4 and after migration, there are a few errors. One of them is Method 'initialize()' defines Objective-C class method 'initialize', which is not permitted by Swift
in IQToolbar of IQKeyboardManager
, how to fix this?
- You can also use Singleton solve this problem such as:
static let shared : AudioTools = {
$0.initialize()
return $0
}(AudioTools())
Your Objective-C method--->initialize
override class func initialize(){code here}
change:
func initialize(){code here}
Your method here:
func playSound(fileName:String?) {
code here
}
use in Swift3:
let audioPlayer = AudioTools.playMusic(fileName: fileName)
use in Swift4
let audioPlayer = AudioTools.shared.playMusic(fileName: fileName)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With