Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/schickling/Device.swift
Super-lightweight library to detect used device
https://github.com/schickling/Device.swift
device-detection ios swift ui-device
Last synced: about 1 month ago
JSON representation
Super-lightweight library to detect used device
- Host: GitHub
- URL: https://github.com/schickling/Device.swift
- Owner: schickling
- License: mit
- Created: 2015-07-20T09:37:46.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2020-10-26T19:41:35.000Z (almost 4 years ago)
- Last Synced: 2024-08-13T06:01:19.423Z (about 1 month ago)
- Topics: device-detection, ios, swift, ui-device
- Language: Swift
- Homepage:
- Size: 72.3 KB
- Stars: 220
- Watchers: 7
- Forks: 70
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-ios - Device.swift - Super-lightweight library to detect used device. (Hardware / Other Hardware)
- awesome-swift - Device.swift - Super-lightweight library to detect used device. (Libs / Device)
- awesome-swift - Device.swift - Super-lightweight library to detect used device. (Libs / Device)
- awesome-ios-star - Device.swift - Super-lightweight library to detect used device. (Hardware / Other Hardware)
- fucking-awesome-swift - Device.swift - Super-lightweight library to detect used device. (Libs / Device)
- awesome-swift-cn - Device.swift - Super-lightweight library to detect used device. (Libs / Utility)
- awesome-swift - Device.swift - Super-lightweight library to detect used device ` 📝 a year ago ` (Device [🔝](#readme))
README
# Device.swift
[![Language][lang-image]][lang-url]
[![License][license-image]][license-url]
[![Platform][platform-image]][cocoapod-url]
[![Documentation][docs-image]][docs-url]
[![Pod Version][pod-version-image]][cocoapod-url]
[![Carthage Compatible][carthage-image]][carthage-url]Super-lightweight library to detect used device
`Device.swift` extends the `UIDevice` class by adding a property:
```swift
var deviceType: DeviceType
```## Install
### Carthage
Add the following to your `Cartfile` and follow [these instructions](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application)
```bash
github "schickling/Device.swift"
```### CocoaPods
To integrate `Device` into your project add the following to your `Podfile`:
```ruby
platform :ios, '8.0'
use_frameworks!pod 'Device.swift'
```## Usage
```swift
import Device// Use import Device_swift if you're using Cocoapods
let deviceType = UIDevice.current.deviceType
switch deviceType {
case .iPhone6SPlus: print("Do stuff for iPhone6S Plus")
case .iPadMini: print("Do stuff for iPad mini")
default: print("Check other available cases of DeviceType")
}
```## How to make release
- Update pod version in podspec
- Add tag
- Add validate pod `pod trunk push Device.swift.podspec --allow-warnings`
- Push to CocoaPods
- Create release in github for with attached file for carthage```sh
carthage build --no-skip-current
carthage archive Device
```Also, check out our [Documentation][docs-url]
[carthage-image]: https://img.shields.io/badge/Carthage-compatible-4BC51D.svg
[docs-image]: https://img.shields.io/cocoapods/metrics/doc-percent/Device.swift.svg
[lang-image]: https://img.shields.io/badge/swift-4.1-orange.svg
[license-image]: https://img.shields.io/github/license/schickling/Device.swift.svg
[platform-image]: https://img.shields.io/cocoapods/p/Device.swift.svg
[pod-version-image]: https://img.shields.io/cocoapods/v/Device.swift.svg
[carthage-url]: https://github.com/Carthage/Carthage
[cocoapod-url]: http://cocoapods.org/pods/Device.swift
[docs-url]: http://cocoadocs.org/docsets/Device.swift
[homepage-url]: https://github.com/schickling/Device.swift.svg
[lang-url]: https://swift.org/
[license-url]: LICENSE