Refactor isDevice check to computed property
Refactor isDevice property to use computed property and better simulator detection API.
This commit is contained in:
committed by
GitHub
parent
ee78f04d33
commit
1164b50cc2
@@ -3,7 +3,13 @@ import UIKit
|
|||||||
import AudioToolbox
|
import AudioToolbox
|
||||||
|
|
||||||
public class SwiftVibratePlugin: NSObject, FlutterPlugin, VibrateApi {
|
public class SwiftVibratePlugin: NSObject, FlutterPlugin, VibrateApi {
|
||||||
private let isDevice = TARGET_OS_SIMULATOR == 0
|
private var isDevice: Bool {
|
||||||
|
#if targetEnvironment(simulator)
|
||||||
|
return false
|
||||||
|
#else
|
||||||
|
return true
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
public static func register(with registrar: FlutterPluginRegistrar) {
|
public static func register(with registrar: FlutterPluginRegistrar) {
|
||||||
let messenger : FlutterBinaryMessenger = registrar.messenger()
|
let messenger : FlutterBinaryMessenger = registrar.messenger()
|
||||||
|
|||||||
Reference in New Issue
Block a user