ProductPromotion
Logo

Swift

made by https://0x3d.site

GitHub - bojan/Thingy: A modern device detection and querying library.
A modern device detection and querying library. Contribute to bojan/Thingy development by creating an account on GitHub.
Visit Site

GitHub - bojan/Thingy: A modern device detection and querying library.

GitHub - bojan/Thingy: A modern device detection and querying library.

Thingy

A modern device detection and querying library.

Build Status GitHub license SPM Carthage compatible codecov

Features

  • Swift 5 support
  • Modern syntax
  • Documentation
  • Device detection
  • Device family detection
  • Device screens
  • Simulator detection
  • Simple querying

Requirements

Installation

Swift Packager Manager (SPM)

Use Xcode 11 to add Thingy as a package or update your Package.swift for manual setups:

import PackageDescription

let package = Package(
    name: "HelloWorld",
    dependencies: [
        .Package(url: "https://github.com/bojan/Thingy.git", "3.0.0")
    ]
)

Carthage

Add this to your Cartfile:

github "bojan/Thingy"

Manually

Add the repository as a submodule to your project.

git submodule add https://github.com/bojan/Thingy.git Vendor/Thingy

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:


let myDevice = 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

let myDevice = Device()

do {
    let result = try myDevice.isEqual(to: Thingy.iPadPro12Inch)
}
catch {
    print("The devices are incompatible.")
}

do {
    let result = try myDevice.isOlder(than: Thingy.iPadPro10Inch)
}
catch {
    print("The devices are incompatible.")
}

Device size

let myDevice = 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.

Author

Bojan Dimovski

License

Thingy is available under the WTFPL license. Check the LICENSE file for more info.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here ๐Ÿ”ฅ.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here ๐Ÿ”.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory