You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open the newly created folder in Finder and drag Thingy.xcodeproj to your project.
In your project's settings, select your target and under General > Embedded Binaries, add the framework depending on the target OS (iOS, watchOS or tvOS).
Usage
Import the module where needed:
import Thingy
Device properties
Inspect the current device:
letmyDevice=Device()
// Compare models or product families
if myDevice.family ==.tv {print("This is an Apple TV device.")}if myDevice.model !=.iPhoneXSMax {print("This is NOT an iPhone XS Max.")}
// Pretty printed device properties
print(myDevice.family.marketingName) // e.g. iPad
print(myDevice.model.marketingName) // e.g. iPhone 7 Plus
print(myDevice.productLine.marketingName) // e.g. Air
Model comparison
letmyDevice=Device()do{letresult=try myDevice.isEqual(to:Thingy.iPadPro12Inch)}catch{print("The devices are incompatible.")}do{letresult=try myDevice.isOlder(than:Thingy.iPadPro10Inch)}catch{print("The devices are incompatible.")}
Device size
letmyDevice=Device()if myDevice.display ==.screen10_5Inch {print("This is the 10.5in iPad Pro.")}
Contributions
All contributions and suggestions are welcome and very much appreciated.
Should you have a feature request or a problem that you may experience, feel free to open an issue.
If you are willing to contribute by adding a feature or squashing a bug or two, please submit a pull request.