Trying to make software development less painful and more fun one repository at a time.
If you have any questions or would like to get in contact please feel free to open an issue or find me on twitter.
UIDevice extensions that fill in the missing pieces.
License: MIT License
Trying to make software development less painful and more fun one repository at a time.
If you have any questions or would like to get in contact please feel free to open an issue or find me on twitter.
@vincentneo Mind checking one more time and pushing the Pod specification if it looks good to you?
Gents,
Would you work your magic for the 12's? I think they ship Oct 23rd...
The profiles are in Xcode Version 12.1 (12A7403)
TY in advance - you all are awesomeness.
:)
In identifier.swift lines 47 and 49 need to be changed to the following to be compliant with Swift 4:
let type = identifierString.prefix(while: { !numericCharacters.contains(String($0))})
let version = identifierString.suffix(from: type.endIndex)
'characters' has been deprecated.
Seen a couple of reports and first-hand experience that seems to suggest that libraries can no longer support iOS 11 and below in order to successfully be archived for app submission.
Have not tested on this library so I won't make any changes until I have done so.
The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 14.0.99.
Hi,
This is a great libary, I am not referencing it as a pod but integrating it as a Library but for some reason its creating a compilation issue for the first line in this function saying :
Ambiguous use of 'dc'
func ipadSize1024() -> Double {
let deviceModel = UIDevice().dc.deviceModel // the error is on this line
switch deviceModel {
case .iPadMini, .iPadMini2, .iPadMini3, .iPadMini4, .iPadMini5: return 7.9
case .iPadPro10_5Inch: return 10.5
case .iPadSevenGen: return 10.2
default: return 9.7
}
}
Is there any way of fixing this and yes I would like to use it directly not as a pod please :)
Thank you,
Wael
Can these be added please? You all are great :)
.podspec is updated to v2.2.0, but remained the previous version over at CocoaPods site.
new phones are:
iPhone 14 -> iPhone14,7
iPhone 14 Plus -> iPhone14,8
iPhone 14 Pro -> iPhone15,2
iPhone 14 Pro Max -> iPhone15,3
I'll make a PR.
Also: there perhaps should be a new indicator, similar to has hasNotch
for the new 'not notch'; perhaps hasDigitalIsland
@vincentneo This pull request was just sent over #51
Maybe we should check everything and make sure there are no other existing issues for XCode 12.
If there are no further issues then lets put out a new release!
2.9.0 is released, but CocoaPods is only seeing 2.8.1...
:(
Hi all, in Xcode 14, cStrings are required to be null-terminated. Because this was changed, apps with Xcode 14 targeting any version of iOS now fail at launch. I have fixed this and will link a PR in a moment
As of this writing Cocoapods installs a version of UIDeviceComplete that lacks the iPhone XS, XS Max and XR. Please update Cocoapods with this version.
UIdevice.current.dc.commonDeviceName // iPad Pro (12.9 inch, Wi-Fi+LTE)
UIdevice
-> UIDevice
New Devices are:
10th gen -> (13, 18), (13, 19)
11 4th gen -> (14, 3), (14, 4)
12.9 6th gen -> (14, 5), (14, 6)
I'll make a PR...
Xcode Version 13.0 (13A233) has the simulators for the new devices - can we get them added, please?
I think some of these are shipping in a week so eager to get them ID'd with UIDeviceComplete!!!
Appreciate you all! & ty in advance!
Regarding:
// MARK: - Detecting Screen size in Inches
extension Screen {
public var sizeInches: Double? {
switch (height, scale) {
case (480, _): return 3.5
case (568, _): return 4.0
case (667, 3.0), (736, _): return 5.5
case (667, 1.0), (667, 2.0): return 4.7
case (812, 3.0): return 5.8
case (896, 2.0): return 6.1
case (896, 3.0): return 6.5
case (1024, _): return ipadSize1024()
case (1080, _): return 10.2
case (1112, _): return 10.5
case (1133, _): return 8.3
case (1180, _): return 10.9
case (1194, _): return 11.0
case (1366, _): return 12.9
default: return nil
}
}
func ipadSize1024() -> Double {
let deviceModel = UIDevice().dc.deviceModel
switch deviceModel {
case .iPadMini, .iPadMini2, .iPadMini3, .iPadMini4, .iPadMini5: return 7.9
case .iPadPro10_5Inch: return 10.5
default: return 9.7
}
}
}
iPhone 12 ProMax & 13 ProMax have a 6.7
iPhone 12 mini & 13 mini have a 5.4
First of all thanks for your work on this library :)
If I'm not mistaken, since sizeInches
only looks at the screen's height
, it can be wrong about the device's size in some situations.
For example, a 12.9" iPad Pro in landscape mode happens to have a "height
" of 1024
, which results in sizeInches
returning 9.7
.
As another example, a 9.7" iPad in landscape mode has a "height
" of 768
, which results in sizeInches
returning nil
.
Is this known or by design? Maybe there's a way of correctly getting device size in landscape mode?
For reference, here's the code computing sizeInches
:
extension Screen {
public var sizeInches: Double? {
switch (height, scale) {
case (480, _): return 3.5
case (568, _): return 4.0
case (667, 3.0), (736, _): return 5.5
case (667, 1.0), (667, 2.0): return 4.7
case (812, 3.0): return 5.8
case (896, 2.0): return 6.1
case (896, 3.0): return 6.5
case (1024, _): return ipadSize1024()
case (1080, _): return 10.2
case (1112, _): return 10.5
case (1133, _): return 8.3
case (1180, _): return 10.9
case (1194, _): return 11.0
case (1366, _): return 12.9
default: return nil
}
}
func ipadSize1024() -> Double {
let deviceModel = UIDevice().dc.deviceModel
switch deviceModel {
case .iPadMini, .iPadMini2, .iPadMini3, .iPadMini4, .iPadMini5: return 7.9
case .iPadPro10_5Inch: return 10.5
default: return 9.7
}
}
}
❯ bundle exec pod install
Analyzing dependencies
Downloading dependencies
Installing UIDeviceComplete (2.7.3)
[!] Unable to determine Swift version for the following pods:
- `UIDeviceComplete-library` does not specify a Swift version and none of the targets (`MyTarget`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.
Setting SWIFT_VERSION
in my project fixes this. But specifying Swift version in the podspec would be more correct.
using:
let screenSize: Double = UIDevice.current.dc.screenSize.sizeInches
on the iPad 7th gen is returning nil instead of the expected 10.2
New models should be added.
I'll go ahead and add them if you all want to check the work... Give me a little bit...
My private pod depends on your library: s.dependency 'UIDeviceComplete', '~> 2.7'
When I install pods, only v2.7.3 is fetched:
❯ bundle exec pod install --repo-update
Updating local specs repositories
Analyzing dependencies
Downloading dependencies
Installing UIDeviceComplete (2.7.3)
...
Temporary workaround is to point to the repo directly in Podfile
:
pod 'UIDeviceComplete', :git => 'https://github.com/Nirma/UIDeviceComplete.git', :commit => '7fa25cf6c648a0c5fa4bb8c182fb91c7ded3e861'
using:
Xcode 11.1GM (11A1027)
iOS 13.1
Simulator XS
& code:
switch device {
case .iPhoneXR, .iPhone11:
print("test:sized for found:", device)
print("test:adjustments for: XR, 11")
break
case .iPhone11Pro, .iPhoneX, .iPhoneXS:
print("test:sized for found:", device)
print("test:adjustments for: 11Pro, X, XS")
break
default:
print("test:sized for default:", device)
break
}
the output for the XS:
test:sized for default: unknown
Same for the XS Max. other devices seem to be ok. Is this a bug?
Ty
When running on an iPhone 12 mini
UIDevice.current.dc.screenSize.height = 812
UIDevice.current.dc.screenSize.scale = 3
UIDevice.current.dc.screenSize.sizeInches = 5.8
But with Display Zoom turned on I get these values:
UIDevice.current.dc.screenSize.height = 693
UIDevice.current.dc.screenSize.scale = 3
And since there is no match, sizeInches is nil.
The result is on the screen http://take.ms/byb1H
Since DeviceFamily.isSimulator
relies on checking if architecture is i386 or x86_64, it is not accurate when user is using a Mac containing an arm64 processor such as M1.
Xcode Version 11.4.1 (11E503a)
iOS 13.1.4
Simulator iPhone SE 2nd Gen
& code:
let device = UIDevice.current.dc.deviceModel
Returns "unknown"
We love your library, very well thought out and written, but it has a problem with Swift Package Manager, you can reproduce it with Xcode 11.3. Can you have a look?
Cannot convert value of type 'Int' to expected element type 'SwiftVersion'
Can the new iPads be added please? Simulators/profiles are in Xcode Version 12.5 (12E262).
TY in advance!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.