LoginSignup
21
11

More than 5 years have passed since last update.

Swift4.1 Simulatorか実機かを判別する方法

Posted at

Swift4.1より前はこんな感じでした。

~4.0.swift
#if (arch(i386) || arch(x86_64)) && os(iOS)
    // iOS simulator code
#endif

Swift4.1からはこう書きましょうという話。

4.1~.swift
#if targetEnvironment(simulator)
    // iOS simulator code
#endif

詳しくは下記のTarget environment conditionへどうぞ。

https://swift.org/blog/swift-4-1-released/

21
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
21
11