Skip to content

Instantly share code, notes, and snippets.

View 1998code's full-sized avatar
👨‍💻
Hello World!

MING 1998code

👨‍💻
Hello World!
View GitHub Profile
@1998code
1998code / demoButton.swift
Last active December 18, 2021 12:24
SwiftUI 3 save contacts button
// iOS 15 or above
Button("+ Add to Contacts") {
// Create a mutable object to add to the contact.
// Mutable object means an object state that can be modified after created.
let contact = CNMutableContact()
// Name
contact.givenName = "Ming"
// Phone No.
contact.phoneNumbers = [CNLabeledValue(label: CNLabelPhoneNumberiPhone, value: CNPhoneNumber(stringValue: "12345678"))]
SignInWithAppleButton(
// Request User FullName and Email
onRequest: { request in
// You can change them if needed.
request.requestedScopes = [.fullName, .email]
},
// Once user complete, get result
onCompletion: { result in
// Switch result
switch result {
//
// ViewController.swift
// ARMotion
//
// Created on 9/2/20.
//
// Give Credit to Sarang Borude @sarangborude
import UIKit
import SceneKit
//
// ARCView.swift
// ARMotion
//
// Created on 9/2/20.
//
import SwiftUI
import Lottie