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
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()
@yusufozgul
yusufozgul / GradientLabel.swift
Last active May 27, 2019
Gradient color for label
View GradientLabel.swift
// Label oluşturup gradient view'umuza ekliyoruz.
let gradientLabel = UILabel(frame: view.bounds)
// Tha magic! Burada gradientLabel'ı view'a maske olarak geçiriyoruz.
view.mask = gradientLabel
gradientLabel.text = "Hello World"
gradientLabel.font = UIFont.boldSystemFont(ofSize: 30)
gradientLabel.textAlignment = .center
gradientView.addSubview(gradientLabel)
You can’t perform that action at this time.