This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Bir view oluşturalım. | |
let gradientView = UIView(frame: CGRect(x: 0, y: 0, width: 400, height: 400)) | |
// gradient layer oluşturuyoruz | |
let gradient = CAGradientLayer() | |
// gradient'imiz için renkleri array halinde ekliyoruz. | |
gradient.colors = [UIColor.red.cgColor, UIColor.blue.cgColor] | |
// soldan sağa gradient olması |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!)") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func viewDidLoad() | |
{ | |
super.viewDidLoad() | |
let authButton = ASAuthorizationAppleIDButton() | |
authButton.addTarget(self, action: #selector(authAppleID), for: .touchUpInside) | |
view.addSubview(authButton) | |
authButton.center = view.center | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBAction func error(_ sender: Any) | |
{ | |
let generator = UINotificationFeedbackGenerator() | |
generator.notificationOccurred(.error) | |
} | |
@IBAction func succes(_ sender: Any) | |
{ | |
let generator = UINotificationFeedbackGenerator() | |
generator.notificationOccurred(.success) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var buttonsText = ["AC", "±", "%", "÷", | |
"7", "8", "9", "x", | |
"4", "5", "6", "-", | |
"1", "2", "3", "+", | |
"0", "00", ".", "="] | |
@State var screenValue = "0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
OlderNewer