-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added NSObject, ByDevice, and hasDynamicIsland
- Loading branch information
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
Sources/NotPrivateApis/NotPrivateApis.docc/NSObject/ByDevice/ByDevice.md
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,15 @@ | ||
# ByDevice | ||
|
||
@Metadata { | ||
@TitleHeading("Class") | ||
@PageColor(blue) | ||
} | ||
Seems to be similar to `UIDevice` | ||
|
||
## Overview | ||
|
||
> Warning: It is unknown when this class was added, and to which operating systems, testing is required before production use. `ByDevice` may be removed at any time. | ||
## Topics | ||
|
||
- <doc:hasDynamcIsland> |
24 changes: 24 additions & 0 deletions
24
Sources/NotPrivateApis/NotPrivateApis.docc/NSObject/ByDevice/hasDynamcIsland.md
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,24 @@ | ||
# hasDynamcIsland | ||
Detect if a device has the Dynamic Island. | ||
|
||
@Metadata { | ||
@TitleHeading("Instance Property") | ||
@PageColor(green) | ||
} | ||
|
||
## Overview | ||
|
||
`hasDynamicIsland` is a property of [`ByDevice`](<doc:ByDevice>) that can provide a non-hardcoded boolean value of whether or not a device has the Dynamic Island | ||
|
||
> Warning: It is unknown when this property of `ByDevice` was added, and to which operating systems, testing is required before production use. `ByDevice` and/or `hasDynamicIsland` may be removed at any time. | ||
## Method | ||
|
||
We can use this code to get the future-proof boolean: | ||
```swift | ||
let BYDeviceClass = NSClassFromString( "BYDevice") as! NSObject.Type | ||
let bydevice = BYDeviceClass.perform(NSSelectorFromString("currentDevice")).takeUnretainedValue() as! NSObject | ||
let hasDynamicIsland = bydevice.value(forKey: "hasDynamicIsland") as! Bool | ||
|
||
print(hasDynamicIsland) | ||
``` |
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