ios - How do I detect my iPhone tilting upwards? -
i'm trying print statement when coremotion detects when iphone tilts upwards. can't seem figure out how make work. have right now:
if manager.isdevicemotionavailable { manager.devicemotionupdateinterval = 0.01 manager.startdevicemotionupdates(to: queue) { [weak self] (data: cmdevicemotion?, error: error?) in print("tilted!!") } } }
tilted!! not being printed don't know if there's wrong code when tilt phone , it's not working. thanks!
Comments
Post a Comment