Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented Dynamic island detection property. #116

Merged
merged 1 commit into from
Apr 22, 2023
Merged

Implemented Dynamic island detection property. #116

merged 1 commit into from
Apr 22, 2023

Conversation

alexanderkhitev
Copy link
Contributor

Hello, I faced a case where I can detect dynamic island on iPhone. I also noticed that some developers also are interested in this case/issue on StackOverflow.

So I decided to implemented a new computed property for this great framework. Thanks.

@alexanderkhitev
Copy link
Contributor Author

cc: @Ekhoo

extension Device {
static public var hasDynamicIsland: Bool {
switch version() {
case .iPhone14Pro, .iPhone14Pro_Max:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend to do as, because all the past models don't have it / will ever have in future.

case .iPhone14Pro, .iPhone14Pro_Max:
return false
default:
return false

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @kishorepran ! Thank you for your feedback and recommendation. But if we'll use default case we can face some bugs in the near future, for example with current/my implementation when some contributors add new case (for example iPhone 15 Pro) Xcode shows an error/warning that we need to add this case inside hasDynamicIsland computed property and we don't forget it.

@kishorepran kishorepran merged commit 5580a3c into Ekhoo:master Apr 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants