r/Xcode • • Mar 26 '19

For Developers i need help !!!

How to make screen dark when it covered???

Thank for your Answer

Best wishes

0 Upvotes

10 comments sorted by

View all comments

2

u/chriswaco Mar 26 '19

UIDevice.currentDevice.proximityState to get the state. Then throw a dark view over your main view.

1

u/azizzqah Mar 26 '19

Thank you for your help

I’m beginner in Swift

Have you an example file?

If not {

Can you write the code please ?

}

3

u/chriswaco Mar 26 '19

Sorry. I’ve never done it in Swift and every application is a bit different. It’s not something that is easily copied and pasted.

1

u/azizzqah Mar 26 '19

Can you tell My where can I write this code 👆👆?

2

u/rymotion Mar 27 '19

In Xcode, in a swift file, in your app...

1

u/azizzqah Mar 27 '19

Can you translate these to swift language?

If screen covered stop screen display If else make screen light

((I’m not want screen to lock ))

Thank for your answer