Skip to content

Instantly share code, notes, and snippets.

🏠
Working from anywhere

Yusuf Özgül yusufozgul

🏠
Working from anywhere
Block or report user

Report or block yusufozgul

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yusufozgul
yusufozgul / Alert,ActionSheet-SwiftUI.swift
Last active Aug 5, 2019
SwiftUI Alert & Action Sheet
View Alert,ActionSheet-SwiftUI.swift
struct ContentView: View
{
@State var isShowAlert = false
@State var isShowActionSheet = false
var body: some View
{
VStack
{
View PresentationLink.swift
View ListRowPresent.swift
struct ThridViewRow : View {
var city: String
var body: some View {
Text(city)
}
}
struct ThirdView : View
{
var listElement = ["Antalya", "İzmir", "İstanbul", "Ankara", "Muğla", "Çanakkale", "Bursa", "Adana"]
View NavigationLink.Swift
View Calculator-SwiftUI-2.swift
var buttonsText = ["AC", "±", "%", "÷",
"7", "8", "9", "x",
"4", "5", "6", "-",
"1", "2", "3", "+",
"0", "00", ".", "="]
@State var screenValue = "0"
var calculator = Calculator()
var body: some View {
VStack { // Vertical Stack İçerisindeki elemanları yatay olarak alt alta ekler
View Calculator-SwiftUI-1.swift
var buttonsText = ["AC", "±", "%", "÷",
"7", "8", "9", "x",
"4", "5", "6", "-",
"1", "2", "3", "+",
"0", "00", ".", "="]
@State var screenValue = "0"
View FeedbackGenerator.swift
@IBAction func error(_ sender: Any)
{
let generator = UINotificationFeedbackGenerator()
generator.notificationOccurred(.error)
}
@IBAction func succes(_ sender: Any)
{
let generator = UINotificationFeedbackGenerator()
generator.notificationOccurred(.success)
View viewDidLoad.swift
override func viewDidLoad()
{
super.viewDidLoad()
let authButton = ASAuthorizationAppleIDButton()
authButton.addTarget(self, action: #selector(authAppleID), for: .touchUpInside)
view.addSubview(authButton)
authButton.center = view.center
}
View extension.swift
extension ViewController: ASAuthorizationControllerDelegate, ASAuthorizationControllerPresentationContextProviding
{
func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization)
{
guard let appleIDCredential = authorization.credential as? ASAuthorizationAppleIDCredential else { return }
print("USER: \(appleIDCredential.user)")
print("EMAIL: \(appleIDCredential.email!)")
print("FULL NAME: \(appleIDCredential.fullName!)")
}
@yusufozgul
yusufozgul / authAppleID().swift
Last active Jun 12, 2019
Sign in with Apple
View authAppleID().swift
@objc func authAppleID()
{
let appleIDProvider = ASAuthorizationAppleIDProvider()
let authRequest = appleIDProvider.createRequest()
authRequest.requestedScopes = [.email, .fullName]
let authController = ASAuthorizationController(authorizationRequests: [authRequest])
authController.presentationContextProvider = self
authController.delegate = self
authController.performRequests()
You can’t perform that action at this time.