-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Replaced device name with model identifier. This provides enough information (e.g. iPhone14,5) to be able to easily cross reference somewhere like https://www.theiphonewiki.com and find the exact device model information. This of course proves useful when wanting to know device characteristics which may relate to an issue. * Removed Mac support. There are several existing compilation issues on Mac already. * Corrected spacing to align with project norms (spaces not tabs)
- Loading branch information
1 parent
229e0ca
commit 30d1cb7
Showing
7 changed files
with
132 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import Foundation | ||
|
||
extension Bundle { | ||
var appBuild: String { getInfo("CFBundleVersion") } | ||
var appVersionLong: String { getInfo("CFBundleShortVersionString") } | ||
var appVersionShort: String { getInfo("CFBundleShortVersion") } | ||
var appBuild: String { getInfo("CFBundleVersion") } | ||
var appVersionLong: String { getInfo("CFBundleShortVersionString") } | ||
var appVersionShort: String { getInfo("CFBundleShortVersion") } | ||
|
||
private func getInfo(_ string: String) -> String { | ||
infoDictionary?[string] as? String ?? "⚠️" | ||
} | ||
private func getInfo(_ string: String) -> String { | ||
infoDictionary?[string] as? String ?? "⚠️" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import UIKit | ||
|
||
extension UIDevice { | ||
|
||
/// The device model identifier e.g. "iPhone14,5" (iPhone 13) or "Simulator" | ||
static var modelIdentifier: String { | ||
var systemInfo = utsname() | ||
uname(&systemInfo) | ||
let machineMirror = Mirror(reflecting: systemInfo.machine) | ||
let identifier = machineMirror.children.reduce("") { identifier, element in | ||
guard let value = element.value as? Int8, value != 0 else { return identifier } | ||
return identifier + String(UnicodeScalar(UInt8(value))) | ||
} | ||
|
||
switch identifier { | ||
case "i386", "x86_64": | ||
return "Simulator" | ||
default: | ||
return identifier | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,7 @@ extension View { | |
} | ||
} | ||
#endif | ||
|
||
|
||
|
||
|