Coder Social home page Coder Social logo

sdiphoneversion's Introduction

SDiPhoneVersion

SDiPhoneVersion

![Gitter](https://badges.gitter.im/Join Chat.svg)

Objective-C library for detecting the running device's model and screen size.

With the new iPhone models, developers have a little more work to do. This library simplifies their job by allowing them to get information about the running device and easily target the ones they want.

NEW: Now supports iPads and iOS Version Finder as well! Check them out bellow!

How to use

      //Check for device model
      if ([SDiPhoneVersion deviceVersion] == iPhone6)
           NSLog(@"You got the new iPhone 6. Nice!");
      else if ([SDiPhoneVersion deviceVersion] == iPhone6Plus)
           NSLog(@"You got the iPhone 6 Plus. Bigger is better!");
	  else if ([SDiPhoneVersion deviceVersion] == iPadAir)
      	 NSLog(@"You own an iPad Air!");

      // Check for device screen size
      if ([SDiPhoneVersion deviceSize] == iPhone4inch)
           NSLog(@"Your screen is 4 inches");
      
      //Get device name
      NSLog(@"%@",[SDiPhoneVersion deviceName]);
      /* e.g: Outputs 'iPhone6,2' */
      
      //Check for iOS Version
      if (iOSVersionGreaterThan(@"8"))
           NSLog(@"You are running iOS 8 or above!");
    

Add to your project

There are 2 ways you can add SDiPhoneVersion to your project:

Manual installation

Simply import the 'SDiPhoneVersion' into your project then import the following in the class you want to use it:

      #import "SDiPhoneVersion.h"

Installation with CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like SDiPhoneVersion in your projects. See the "Getting Started" guide for more information.

Podfile

        platform :ios, '5.0'
        pod "SDiPhoneVersion", "~> "1.0"

Available methods

    +(DeviceVersion)deviceVersion;
    +(DeviceSize)deviceSize;
    +(NSString*)deviceName;

Targetable models

iPhone4
iPhone4S
iPhone5
iPhone5C
iPhone5S
iPhone6
iPhone6Plus

iPad1
iPad2
iPadMini
iPad3
iPad4
iPadAir
iPadMiniRetina

Simulator

Targetable screen sizes

iPhone35inch
iPhone4inch
iPhone47inch
iPhone55inch

Available iOS Version Finder methods

iOSVersionEqualTo(@"V")  //E.g: iOSVersionEqualTo(@"8.0.1")
iOSVersionGreaterThan(@"V")
iOSVersionGreaterThanOrEqualTo(@"V")
iOSVersionLessThan(@"V")
iOSVersionLessThanOrEqualTo(@"V")        

Credits

  • Yasir Turk (iOS Version Finder, StackOverflow)

License

Usage is provided under the MIT License. See LICENSE for the full details.

sdiphoneversion's People

Contributors

sebyddd avatar gitter-badger avatar

Watchers

jack avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.