lib/run_loop/device.rb in run_loop-2.6.6 vs lib/run_loop/device.rb in run_loop-2.7.0

- old
+ new

@@ -226,9 +226,35 @@ # @return [Boolean] Returns true if this is a simulator. def simulator? !physical_device? end + # Is the iOS version installed on this device compatible with an Xcode + # version? + def compatible_with_xcode_version?(xcode_version) + ios_version = version + + if ios_version.major < (xcode_version.major + 2) + if physical_device? + return true + else + # iOS 8 simulators are available in Xcode 9 + # iOS 7 simulators are not available in Xcode 9 + if ios_version.major <= (xcode_version.major - 2) + return false + else + return true + end + end + end + + if ios_version.major == (xcode_version.major + 2) + return ios_version.minor <= xcode_version.minor + end + + false + end + # Return the instruction set for this device. # # **Simulator** # The simulator instruction set will be i386 or x86_64 depending on the # the (marketing) name of the device.