swift 判断真机还是模拟器

 if Platform.isSimulator {
            // Do one thing
            print("isSimulator")
        }
        else {

        }
 
 
 
struct Platform {
    static let isSimulator: Bool = {
        var isSim = false
        #if arch(i386) || arch(x86_64)
            isSim = true
        #endif
        return isSim
    }()
}
原文地址:https://www.cnblogs.com/jiefangzhe/p/8398585.html