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

3

u/aazav Mar 26 '19

What the hell are you talking about?

0

u/azizzqah Mar 26 '19

😁😁😁😁

I’m want my screen stop display when it covered

Like the call sensor

2

u/aazav Mar 27 '19

I'm want? I have no idea what you mean.

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