Skip to content

Instantly share code, notes, and snippets.

View MaatheusGois's full-sized avatar
🎯
Focusing

Matheus Gois MaatheusGois

🎯
Focusing
View GitHub Profile
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
@MaatheusGois
MaatheusGois / GradientLayer.md
Created April 13, 2022 17:49 — forked from hcn1519/GradientLayer.md
UITableViewCell with GradientLayer in swift

Create GradientLayer on your tableViewCell(collectionViewCell)

1. Create CAGradientLayer Instance on your tableViewCell

class MyCell: UITableViewCell {
    let gradientLayer = CAGradientLayer()
}
@MaatheusGois
MaatheusGois / bash
Created April 15, 2020 20:07
Comandos
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:
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
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
setUpSignInAppleButton()
}
//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() {
@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
@IBOutlet weak var authorizationButton: ASAuthorizationAppleIDButton!
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
import AuthenticationServices