Code Monkey home page Code Monkey logo

device's People

Contributors

417-72ki avatar alexanderkhitev avatar arasu01 avatar assaulter avatar bbheck avatar ben305 avatar cruisediary avatar ekhoo avatar felixbuenemann avatar glm4 avatar gotvitch avatar kishorepran avatar mh7821 avatar mickamy avatar mlch911 avatar nikans avatar ozgur avatar pchelnikov avatar pglongo avatar readmecritic avatar rinov avatar segolenef avatar sochalewski avatar sshruti20 avatar stevemoser avatar sweefties avatar tbaranes avatar vincedev avatar vulgur avatar zlfyuan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

device's Issues

Fall back device size

Apple releases new devices each year(sometimes some season), and it force this library to release new version whenever new size of device came out.

When it comes to device size, most of people expect this lib to do its best effort, I think.

So I'd like to propose Device.size to return the nearest size as long as they know in the released version.

Once my proposal accepted, Device.size would be implemented like below.

    static public func size() -> Size {
        / * bra bra bra * /
        switch screenHeight {
            case 0...480:
                return .screen3_5Inch
            case 481...568:
                return .screen4Inch
            case 569...667:
                return UIScreen.main.scale == 3.0 ? .screen5_5Inch : .screen4_7Inch
            case 668...736:
                return .screen5_5Inch
           /* and so on... */

What do you people think about this?

Suggestion for more helper functions

Hey,

I think it would be really useful (for me at least) if we could have some extra helper functions that simply return either true or false. A function that returns true if the current device is either a 4inch or below etc.

Of course I can just write them myself in my project, but thought it might be useful if they were part of this lib. What do you think?

Support for iPad mini (5th Generation)

Added a fue lines of code to support the iPad mini 5:

In version.swift added:

case iPadMini5

In device.swift added:

case "iPad11,1", "iPad11,2": return .iPadMini5

MOUNTING ADRUINO FILES?

I'm sorry its not the arruino. It's the Orange pi 3 that I am have issues with. When I turn it on it goes into a white screen even though the background is still working. I'm trying to see how I can take the white screen out or off. Or is there any way to reset the hardware.

Update models

Thanks for your library, can you update the newer devices ?

helpers - isIphoneX

I tried

if Device.version == .iPhoneX
if Device.type == .iPhoneX

both failed on simulator.

this worked.

 if UIDevice.isIphoneX


extension UIDevice {
    static var isIphoneX: Bool {
        var modelIdentifier = ""
        if isSimulator {
            modelIdentifier = ProcessInfo.processInfo.environment["SIMULATOR_MODEL_IDENTIFIER"] ?? ""
        } else {
            var size = 0
            sysctlbyname("hw.machine", nil, &size, nil, 0)
            var machine = [CChar](repeating: 0, count: size)
            sysctlbyname("hw.machine", &machine, &size, nil, 0)
            modelIdentifier = String(cString: machine)
        }
        
        return modelIdentifier == "iPhone10,3" || modelIdentifier == "iPhone10,6"
    }
    
    static var isSimulator: Bool {
        return TARGET_OS_SIMULATOR != 0
    }
}

Privacy Manifest?

Hello, At WWDC23 Apple announced that apps and SDKs that make use of certain "required reason" APIs etc will need to provide a privacy manifest.
Does Device need to include this manifest?
Is this update on the roadmap for the team? I appreciate that enforcement won't happen until Spring 2024 but I wanted to make contact so that we can plan our own app releases to take this into account.

Here’s some useful references:

https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_data_use_in_privacy_manifests

https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api

https://developer.apple.com/videos/play/wwdc2023/10060/

Thanks

Support Watch OS

Hi,

Any plan to support watch OS ?
I may be able to make a PR if you are open for it.
Lucas.

License violation

The original SDVersion library is protected under MIT License.

I kindly ask you to change the logo and the description as you do not posses permission to use them on your behalf.

Regards,
Sebastian

Podspec deployment target needs to updated

Currently, the podspec specify the deployment target to iOS 8.0.

For other Cocoapods libraries, if you have Device as a dependency pod, your library will not lint correctly your podspec using Xcode 14.3 and up. Please refer to this issue on Cocoapods.
So far there is no way to specify custom deployment targets for dependencies with the Podspec syntax, so this should be resolved by each pod podspec.

This is not a problem if you install the dependency via SPM or directly into your project via cocoapods

Is this project still maintained?

Hi!

Given the number of issues open and the absence of support for the last iOS devices (iPhone 13), I wanted to ask if this project is still being maintained?

Make model identifier (version code) string public

Hi @Ekhoo, thanks for this library, I like it and use it often.

Sometimes model identifier is used in a "raw" value (i.e. "iPhone9,4"), for instance when sending client device information to a backend or similar, but in current version of Device this info is hidden behind static fileprivate func getVersionCode() -> String. Would you mind making that public?

Also, is there a particular reason for all of these version, size, type to be static methods instead of static properties? To me it seems a little bit more convenient if those were just properties instead of methods... What do you think?

Cheers,
// T

1.1.0 is not compatible with 1.0.3

Carthage's operator ~> means
the version equals or later than right-hand version which is compatible with that
And also, this rule from the semantic versioning. http://semver.org/

If you can follow this rule, It's better to version as 2.0.0 because 1.1.0 is just supporting Swift3 and Swift3 is not compatible with Swift2.3 (1.0.3 or earlier).

In other word, if we wrote github "Ekhoo/Device" ~> 1.0.3, we can't build the library without changes of our codes.

Add shorcut isPad, isPhone, isPod

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
    }

Support iPhone 12 Screen Sizes

iPhone 12 Mini: 5.4" with 1080×2340 pixels
iPhone 12 / 12 Pro: 6.1" with 1170×2532 pixels
iPhone 12 Pro Max: 6.7" with 1284×2778 pixels

Display Zoom detection?

Is there a way for this library to detect Display Zoom? It doesn't appear to do so currently.

Any plans for Swift 4?

Even though Swift 3.x and Swift 4 are interchangeable, it would be great if there were a Swift 4 version! Are there any plans for this? Thanks! 😄

Cannot install 3.0.3 via cocoapod

When I install 3.0.3, I get this error.

[!] Unable to satisfy the following requirements:

  • Device (~> 3.0.3) required by Podfile
    None of your spec sources contain a spec satisfying the dependency: Device (~> 3.0.3).

I can only install it up to 3.0.2, any idea to fix this?

iPad Recognition

This framework cannot currently recognize iPad Minis

Additionally it cannot differentiate between the new Gen 2 iPad Pros. The classification information in the iPad pro section conflicts with other reports of what they should be.

iPad Screen Sizes

The screen sizes are there for the iPhones, but not for the iPads.

enhancement: Device info` func` to singleton

how about creating variable like singleton than func size, type, version

because after once called, size, type, version never changed in same device

everytime, when use Device.size(), Device.getVersion() ... every time calculated

Any support of Privacy Manifest?

Do you have any plans to add a Privacy Manifest to this library?

Is this library not required to be supported?

Thank you very much!

“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.

Experiencing this using Xcode 8.1 and Swift 3. After installing with cocoapods, I'm getting this build error:

“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.

I remember having to do this for Swift 2.3 about a month ago, but looking at the releases for the repo I assumed that master would work just fine for swift 3 projects.

Update podspec to 3.1.2

So cocoapods downloads the version 3.1.0 of the library without all the latest changes as the version specified in the podspec is 3.1.0 and not 3.1.2

Wrong screen height for iPhone 11 Pro Max

case 896:
                switch version() {
                case .iPhoneXS_Max:
                    return .screen6_5Inch
                default:
                    return .screen6_1Inch
                }

should be

case 896:
                switch version() {
                case .iPhoneXS_Max, iPhone11Pro_Max:
                    return .screen6_5Inch
                default:
                    return .screen6_1Inch
                }

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.