Skip to content

Instantly share code, notes, and snippets.

@alkozin
Last active July 12, 2022 12:32
Show Gist options
  • Save alkozin/2a775e77451878463e1e918564eaf9da to your computer and use it in GitHub Desktop.
Save alkozin/2a775e77451878463e1e918564eaf9da to your computer and use it in GitHub Desktop.
//Working examples
//Async
//Anything from Nothing
|{ (anything: Anything) in
🧙🏼
}
//Determinate user's location
|{ (location: CLLocation) in
}
//Receive pedometer data
|{ (data: CMPedometerData) in
}
//Find bluetooth peripheral near
|{ (peripheral: CBPeripheral) in
}
//Detect motion
|{ (motion: UIEvent.EventSubtype) in
if motion == .motionShake {
}
}
//Subscribe to notification
UIWindow.keyboardWillShowNotification | { (n: Notification) in
}
//Look for a contact
CNContact.predicateForContacts(matchingName: "John Appleseed") | .every { (contact: CNContact) in
}
//Read hardware NFC tag
|{ (tag: NFCNDEFTag) in
}
//Write NFC tag
let write: NFCNDEFMessage = URL(string: filtered)|
tag | write | { (error: Error?) in
}
//Recognize bodies in imageURL
URL(string: "http://example.com/image.jpg") | { (faces: [VNFaceObservation]) in
}
//Recognize bodies in data
data | .while { (bodies: [VNHumanBodyPoseObservation]) in
bodies < 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment