Comments (7)
Hey :)
Currently unfortunately not!
Considerations: How would you compare an iPhone4s to an Pad3? Would you add dates of publications to all of them and compare those?
from devicekit.
On the absurdly simple/stupid/practical side, I'm doing this. I wouldn't recommend it, but I think it works:
public extension Device {
public func isWorseThanIpadAir() -> Bool {
let slowDevices: [Device] = [.iPadMini, .iPad2, .iPad3]
let slowDevicesOnSim : [Device] = slowDevices.map( { device in .Simulator(device) } )
let device = Device()
return device.isOneOf(slowDevices + slowDevicesOnSim)
}
}
// bridge to Objective-C (there must be an easier way)
@objc(DeviceInfoFromDeviceKit)
public class DeviceInfoFromDeviceKit : NSObject {
public class func isWorseThanIpadAir() -> Bool {
return Device().isWorseThanIpadAir()
}
}
Admittedly, it doesn't speak to the question directly, but hopefully it's useful.
from devicekit.
Okay, this is yet another use case / feature (PO asked about devices being older than a specific one), this is not necessarily equal to their CPU/GPU power. Since you already implemented it, is there really a need to know which device is slower / older than another one? If there really is interest in those questions I'll try to create something (I have an idea that could maybe work).
from devicekit.
@dennisweissmann personally I'm glad for what you've built and not really looking for more at this time. I'm amused (and this might be due to my lack of knowledge) at how inaccessible this stuff is from Objective-C, but them's the breaks of truly embracing a new lang. And of course, there are workarounds, so all is good.
Thanks!
from devicekit.
@drosenstark Thank you :) The inaccessibility is mainly due to the fact that I use an enum (which belongs to the group of "not so easily bridgeable to Objc" - at least when they don't implement a raw value, which in turn is not possible if you use associated values). To be honest, it was never my intention to make it work from Objc, but again, if there is a need in this area I'm willing to provide a wrapper (or accept a PR that provides one đ)
from devicekit.
@dennisweissmann hint taken, but I think the most coherent thing to do is to continue to advance as you are. An Objective-C port would make more sense than a wrapper, since there's not much to wrap, functionality-wise. Which perhaps somebody will do at some point... Regarding enums, I think an API like this is not only useful, but it's a good case to study on Swift...
Keep up the good work, thanks!
from devicekit.
Since there is no way other than manually maintaining the dates I decided to not include this. If there is a strong need for it, we might have to find a better solution.
from devicekit.
Related Issues (20)
- Add the Thermal State on any iPhone HOT 1
- Add Watch Series 7 HOT 2
- Add New Devices - iPhone 14, Apple Watch SE (2nd Gen., Apple Watch Ultra / Series 8 HOT 1
- check pod trunk warnings
- How to get physical Size or scale factor HOT 2
- Old version is installed from CocoaPods HOT 2
- Fast charge device support HOT 1
- Failed SwiftUI preview on macOS HOT 1
- .hasDynamicIsland would be a nice convenience method HOT 1
- Broken HOT 2
- looks smart
- Add property for corner radius value of all curved iOS devices HOT 1
- How Can I save the device to defaults? HOT 1
- Compile xcframework for releases
- List supported iOS versions by device
- Support for building with visionOS SDK
- Deprecated: `UIScreen.main` HOT 1
- Add newly released devices HOT 7
- Privacy manifest files
- No longer compiles on visionOS HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
đ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google â¤ī¸ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from devicekit.