Post

Replies

Boosts

Views

Activity

Use iPhone's Proximity Sensor
Hi ✋ I'm trying to build an app with SwiftUI, and I'm completely new to coding. I want to use iPhone's proximity sensor as a feature in my app. This is not what I actually want, but to make it simple: Say there is a number shown on the screen. Whenever I cover the iPhone's proximity sensor with my hand, the number is increased by one. theNumber += 1 import SwiftUI struct ContentView: View {     @State private var theNumber: Int = 0     var body: some View {         Text("\(theNumber)")     } }
3
0
4.6k
Aug ’22