class MyCell: UITableViewCell {
let gradientLayer = CAGradientLayer()
}
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
def add_spm_to_target(project, target_name, url, requirement, product_name) | |
project.targets.each do |target| | |
if target.name == target_name | |
pkg = project.new(Xcodeproj::Project::Object::XCRemoteSwiftPackageReference) | |
pkg.repositoryURL = url | |
pkg.requirement = requirement | |
ref = project.new(Xcodeproj::Project::Object::XCSwiftPackageProductDependency) | |
ref.package = pkg | |
ref.product_name = product_name | |
target.package_product_dependencies << ref |
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
1* Comando: | |
eval `ssh-agent -s` | |
2* Comando: | |
ssh-add ~/.ssh/nomeDaChave.pem | |
3* Comando: | |
openssl rsa -in ~/.ssh/nomeDaChave.pem -pubout -out ~/.ssh/nomeDaChave.pub | |
4* Comando: |
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 { | |
//1 | |
func authorizationController(controller: ASAuthorizationController, | |
didCompleteWithAuthorization | |
authorization: ASAuthorization) { | |
//1.1 | |
if let appleIDCredential = authorization.credential as? | |
ASAuthorizationAppleIDCredential { | |
let userIdentifier = appleIDCredential.user | |
let fullName = 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() | |
// Do any additional setup after loading the view. | |
setUpSignInAppleButton() | |
} |
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
//1 | |
func setUpSignInAppleButton() { | |
authorizationButton.addTarget(self, action: #selector(handleAppleIdRequest), for: .touchUpInside) | |
authorizationButton.cornerRadius = 10 | |
} | |
//2 | |
class ViewController: UIViewController { | |
@IBOutlet weak var authorizationButton: ASAuthorizationAppleIDButton! | |
override func viewDidLoad() { |
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 handleAppleIdRequest() { | |
//1 | |
let appleIDProvider = ASAuthorizationAppleIDProvider() | |
let request = appleIDProvider.createRequest() | |
request.requestedScopes = [.fullName, .email] | |
//2 | |
let authorizationController = ASAuthorizationController(authorizationRequests: [request]) | |
//3 | |
authorizationController.delegate = self | |
//4 |
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
@IBOutlet weak var authorizationButton: ASAuthorizationAppleIDButton! |
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 { // 1 | |
//2 | |
func authorizationController(controller: ASAuthorizationController, didCompleteWithAuthorization authorization: ASAuthorization) { | |
if let appleIDCredential = authorization.credential as? ASAuthorizationAppleIDCredential { | |
let userIdentifier = appleIDCredential.user | |
let fullName = appleIDCredential.fullName | |
let email = appleIDCredential.email | |
print("User id is \(userIdentifier) \n Full Name is \(String(describing: fullName)) \n Email id is \(String(describing: email))") } | |
} | |
//3 |
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
import AuthenticationServices |
NewerOlder