Ekhoo / Device

Light weight tool for detecting the current device and screen size written in swift.
MIT License
1.7k stars 202 forks source link

Add shorcut isPad, isPhone, isPod #18

Closed PGLongo closed 8 years ago

PGLongo commented 8 years ago

First of all, thanks for this pod.

A lot of times I want to check if the current device is of a specific type and I think it would be easier doing

 if(Device.isPad()) //instead of  if (Device.type() == .iPad) 

So what do you think if I create a PR with the following code?

    static public func isPad() -> Bool {
        return Device.type() == .iPad
    }

    static public func isPhone() -> Bool {
        return Device.type() == .iPhone

    }

    static public func isPod() -> Bool {
        return Device.type() == .iPod
    }
Ekhoo commented 8 years ago

Yes if you want you can add thoses shortcuts :) I will release a new version with your changes :)

Ekhoo commented 8 years ago

Hello @PGLongo I have merged your PR and a new version is available :) Thank you a lot ! And sorry to be so slow to merge your work...

PGLongo commented 8 years ago

Thanks to you. I think that you have a lot of works as all the people here!