Skip to content

학습거리

fElix edited this page Oct 31, 2020 · 13 revisions
FE

BE

iOS

2020.10.27 화요일

UICollectionView Cell 사이에 seperator를 적용 시킬 방법

borderWidth나 borderColor를 설정하는 방법 말고 어떤 방법이 있을까

git add 생략하고 바로 commit하는 방법


2020.10.28 수요일

MVVM & ViewModel 적용시킬 방법

  • View와 VC의 관계, 구조에 대해 고민해보기

UIMenuController.shared 의 menuItem의 설정 범위

  • 싱글톤으로 이용했을 때 UIMenuController에 관련된 모든 뷰들이 영향을 받지 않는건지..? 코드가 있는 뷰에서만 적용이 되는데 그 이유가 뭘까

2020.10.31 토요일

Apple에서 로그인에 제공해 주는 UI와 기능들이 존재

  • AuthenticationServices
    1. Project Target -> Signing & Capabilities -> + Capability click -> Sign in with Apple 추가

    2. Button 생성

      lazy var signInButton: ASAuthorizationAppleIDButton = {
        let button = ASAuthorizationAppleIDButton()
        return button
      }()
    3. Button에 Action을 추가

      //MARK:- configureSignInButton()
      signInButton.addTarget(self, action: #selector(signUpButtonTouched), for: .touchUpInside)
      
      @objc private func signUpButtonTouched() {
        let appleIDProvider = ASAuthorizationAppleIDProvider()
        let request = appleIDProvider.createRequest()
        request.requestedScopes = [.fullName, .email]
      
        let authorizationController = ASAuthorizationController(authorizationRequests: [request])
        authorizationController.delegate = self
        authorizationController.presentationContextProvider = self
        authorizationController.performRequests()
      }
    4. ASAuthorizationControllerDelegate 설정

      • didCompleteWithAuthorization: 성공했을 경우
        • authorization를 통해 사용자의 정보를 받아올 수 있다.
        if let appleIDToken = authorization.credential as? ASAuthorizationAppleIDCredential {
          ... 생략 ...
        }
      • didCompleteWithError: 실패했을 경우

      **주의사항 처음 로그인 시에만 fullName, email 변수를 받아올 수 있고 이 후 로그인 시에는 nil값을 받아오기 때문에 처음 로그인 할 경우 fullName, email 값을 따로 저장해 두어야 한다. keychain에 저장하라고 하는데 정확히는 모르겠다...

    5. ASAuthorizationControllerPresentationContextProviding 설정

      • presentationAnchor() : 로그인 뷰를 띄우는 곳을 설정?
      func presentationAnchor(for controller: ASAuthorizationController) -> ASPresentationAnchor {
        guard let window = view.window else { return ASPresentationAnchor() }
        return window
      }

Clone this wiki locally