erisu edited a comment on pull request #133: URL: https://github.com/apache/cordova-plugin-device/pull/133#issuecomment-711471219
IMO, I don't see a need for a new property. I feel that using both the `device.model` and `device.platform` together should be enough to identify if the iOS app is running on a macOS and on which architecture. To recap from what I am reading and understanding from the documentation written in the repo's README, Focusing on the case of building an iOS app and running on a macOS, I expect: * The `device.platform` to return `iOS`. This value is hardcoded [here](https://github.com/apache/cordova-plugin-device/blob/master/src/ios/CDVDevice.m#L91) for the Cordova iOS platform. * The `device.model` should return the device's architecture. `x86_64` or `ARM64` The information in the README says iOS will return the device model (e.g. `iPhone 5,1`), but when running on a macOS, the device model is the hardware's architecture. I confirmed this when running a quick playground test on a macOS, using the same code from [here](https://github.com/apache/cordova-plugin-device/blob/master/src/ios/CDVDevice.m#L29-L43). So to recap, running an iOS app on a macOS, I am expecting: * `device.platform` to equal `iOS` * `device.model` to equal either `x86_64` or `ARM64` I think these two properties combined is enough to know where the iOS app is running and also provides on which architecture when on a macOS. Since we have two existing properties that can be used to create the boolean check and is something that is usable by multiple platforms, can you explain if there are any other reasons why a new property that is only iOS specific is needed? Example Boolean Check: ``` if ( device.platform === 'iOS' && ( device.model === 'x86_64' || device.model === 'ARM64' ) ) { // code here } ``` NOTE: I have not confirmed if `device.model` returns `ARM64` as I do not own an Apple Silicon. The printout might be formatted differently. For example all lowercase, or with spaces, etc. The information is based on expectation from how it works today and what I have tested on my macOS. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
