All Projects → Nirma → Uidevicecomplete

Nirma / Uidevicecomplete

Licence: mit
UIDevice extensions that fill in the missing pieces.

Programming Languages

swift
15916 projects
swift4
162 projects

Projects that are alternatives of or similar to Uidevicecomplete

Kaamelott Soundboard
Ou : chante Sloubi. Nous, on va faire que la soundboard de Kaamelott.
Stars: ✭ 384 (-1.54%)
Mutual labels:  hacktoberfest
Flow Typed
A central repository for Flow library definitions
Stars: ✭ 3,772 (+867.18%)
Mutual labels:  hacktoberfest
Basque
A top-down 2d game engine, written from scratch in under 1000 lines of C. Development of the game based on this engine is streamed on Twitch: https://www.twitch.tv/ryanpcmcquen
Stars: ✭ 388 (-0.51%)
Mutual labels:  hacktoberfest
Awesome Hdl
Hardware Description Languages
Stars: ✭ 385 (-1.28%)
Mutual labels:  hacktoberfest
Collision
💥 Collision is a beautiful error reporting tool for command-line applications
Stars: ✭ 3,993 (+923.85%)
Mutual labels:  hacktoberfest
Online Judge
A modern open-source online judge and contest platform system.
Stars: ✭ 384 (-1.54%)
Mutual labels:  hacktoberfest
Onedal
oneAPI Data Analytics Library (oneDAL)
Stars: ✭ 382 (-2.05%)
Mutual labels:  hacktoberfest
Blueprint
Free, feature-rich, easily customizable Android dashboard for icon packs
Stars: ✭ 389 (-0.26%)
Mutual labels:  hacktoberfest
Isort
A Python utility / library to sort imports.
Stars: ✭ 4,377 (+1022.31%)
Mutual labels:  hacktoberfest
Netflix To Srt
Rip, extract and convert subtitles to .srt closed captions from .xml/dfxp/ttml and .vtt/WebVTT (e.g. Netflix, YouTube)
Stars: ✭ 387 (-0.77%)
Mutual labels:  hacktoberfest
Libphonenumber For Php
PHP version of Google's phone number handling library
Stars: ✭ 3,938 (+909.74%)
Mutual labels:  hacktoberfest
Riot
RIOT - The friendly OS for IoT
Stars: ✭ 4,029 (+933.08%)
Mutual labels:  hacktoberfest
Gdlauncher
GDLauncher is a simple, yet powerful Minecraft custom launcher with a strong focus on the user experience
Stars: ✭ 386 (-1.03%)
Mutual labels:  hacktoberfest
Zacs
Zero Abstraction Cost Styling ⚡️👨‍🎨 (for React DOM & React Native)
Stars: ✭ 385 (-1.28%)
Mutual labels:  hacktoberfest
Active delivery
Ruby framework for keeping all types of notifications (mailers, push notifications, whatever) in one place
Stars: ✭ 388 (-0.51%)
Mutual labels:  hacktoberfest
Fullstaq Ruby Server Edition
A server-optimized Ruby distribution: less memory, faster, easy to install and security-patch via APT/YUM
Stars: ✭ 384 (-1.54%)
Mutual labels:  hacktoberfest
Simple Notes
A simple textfield for adding quick notes without ads.
Stars: ✭ 386 (-1.03%)
Mutual labels:  hacktoberfest
Btorrent
🌐 Fully-featured WebTorrent Client
Stars: ✭ 388 (-0.51%)
Mutual labels:  hacktoberfest
Verible
Verible is a suite of SystemVerilog developer tools, including a parser, style-linter, and formatter.
Stars: ✭ 384 (-1.54%)
Mutual labels:  hacktoberfest
Stan
🕵️ Haskell STatic ANalyser
Stars: ✭ 386 (-1.03%)
Mutual labels:  hacktoberfest

UIDeviceComplete

UIDevice extensions that fill in the missing pieces.

Build Status Swift 5.0 CodeCov CocoaPods compatible Carthage compatible Swift Package Manager compatible License

Whats this library about?

UIDeviceComplete is an iOS library intended to be a collection of extensions to UIDevice that provides functionality that UIDevice currently lacks like determining which iOS device you have (i.e iPhone X, iPhone 8, iPhone SE, iPad Pro, iPhone 7 etc) or determining the screen size of the device in inches.

Features

  • [x] Detect specific device like iPhone 7, iPhone SE or iPad Pro
  • [x] Get screen size of device in inches
  • [x] Get iOS Device family (iPod, iPhone or iPad)

Dont see a feature you need?

Feel free to open an Issue requesting the feature you want or send over a pull request!

Use

All of the extensions are called off of the dc variable which stands for ([UI]DeviceComplete) object that this library extends onto UIDevice that way native methods of UIDevice and methods of this library can easily be seen, also lowering the possibility of naming conflicts.

Getting common device name

UIDevice.current.dc.commonDeviceName // iPad Pro (12.9 inch, Wi-Fi+LTE)

Detecting iOS Device models

let device = UIDevice.current.dc.deviceModel

switch device {
    case .iPhoneX:
        print("So hows that iPhone X notch thing working out? Right...")
    case .iPhone6Plus, .iPhone7Plus:
        print("Lots of screen realestate eh?")
    case .iPhoneSE, .iPhone5, iPhone5S:
        print("Less iPhone is more iPhone...")
    case .iPadPro:
        print("Why?")
    default:
        print("Not sure what this is...")
}

Detecting iOS Device Screen Size (Inches)

Screen size can be be queried with the following computed property returning a simple Double that represents the screen size in inches:

let screenSize: Double = UIDevice.current.dc.screenSize.sizeInches

if screenSize <= 4.0 {
    print("Modest screen size; not so modest price tag")
} else if screenSize >= 5.5 {
    print("Plus is always a plus")
} else {
    print("Chances are this is an iPad or an iPhone (Texas Edition).")
}

Detecting iOS Device Family

If the type of device family is all you are after i.e iPhone or iPad and the specific model is not important then DeviceFamily might be what you need.

let deviceFamily = UIDevice.current.dc.deviceFamily

switch deviceFamily {
    case .iPhone:
        print("...phone home?")
    case .iPad:
        print("when it comes to screen size; more is more")
    case .iPod:
        print("Why not?")
    default:
        print("No family...")
}

Installation

Carthage

If you use Carthage to manage your dependencies, simply add UIDeviceComplete to your Cartfile:

github "Nirma/UIDeviceComplete"

If you use Carthage to build your dependencies, make sure you have added UIDeviceComplete.framework to the "Linked Frameworks and Libraries" section of your target, and have included UIDeviceComplete.framework in your Carthage framework copying build phase.

CocoaPods

If you use CocoaPods to manage your dependencies, simply add this line to your Podfile:

use_frameworks!
pod 'UIDeviceComplete'

Contributing to this project

Contributions are highly welcome

If there is something you wish to fix about the project, or wish to add any other kind of enhancements, propose to add to the project. Please feel free to send over a pull request or open an issue for this project.

License

UIDeviceComplete is released under the MIT license. See LICENSE for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].