View에 그림자 추가
func setShadowProfileView() {
profileView.layer.shadowOffset = CGSize(width: 5, height: 5)
profileView.layer.shadowOpacity = 0.1
profileView.layer.shadowRadius = 10
}
- shadowOffeset: 현재 위치에서 얼마나 떨어진 곳에 그림자를 위치시킬 것인지 CGSize 로 설정해줍니다.
- shadowOpacity: 그림자의 불투명한 정도
- shadowRadius: 그림자의 모서리 조절
애플로그인, 구글로그인 버튼 추가 / 로그인은 미구현
➡️ 구글로그인을 채택한 이유: 국악에 관심있는 전세계 사람들을 타겟으로 했기 때문에 외국인들도 쉽게 이용할 수 있는 구글로그인을 채택하였습니다.
➡️ 애플로그인은 소셜로그인 사용시 필수 구현이기 때문에 함께 구현하였습니다.
애플로그인
import AuthenticationServices
@IBOutlet weak var appleLoginView: UIView!
func setAppleSignInButton() {
let authorizationButton = ASAuthorizationAppleIDButton(type: .signIn, style: .black)
authorizationButton.addTarget(self, action: #selector(touchUpInsideAppleLogInButton), for: .touchUpInside)
appleLoginView.addSubview(authorizationButton)
}
https://huisoo.tistory.com/3?category=941369
[Swift] 애플 로그인 구현 (Sign in with Apple)
이 포스트는 애플 로그인(Sign in with Apple)을 설명하기 위한 포스팅입니다 :) 애플의 공식 문서를 기반으로 작성하였으며, 애플 로그인에 대한 애플의 가이드라인은 여기에서 확인하실 수 있습니
huisoo.tistory.com
구글로그인
import GoogleSignIn
@IBOutlet weak var googleLogInView: GIDSignInButton!
View 로 스토리보드에서 만든 후에 GIDSignInButton 로 버튼의 클래스를 바꿔줍니다.
유저 이름 변경 : NotificationCenter 활용
ChangeUserNameViewController (modal) ➡️ MyPageViewController
모달에서 닉네임을 바꾸고 dismiss 할 때 MypageViewController의 유저 이름을 바로 바꾸기 위해 사용하였습니다.
아직 delegate 패턴이 미숙하여.. 공부해야할듯 합니다.
ChangeUserNameViewController (modal)
let changeUserNameNotification: Notification.Name = Notification.Name("changeUserName")
let userInfoKey: String = "userName"
// 정보를 보낼 곳
NotificationCenter.default.post(name: changeUserNameNotification, object: nil, userInfo: [userInfoKey: name])
MyPageViewController
let changeUserNameNotification: Notification.Name = Notification.Name("changeUserName")
let userInfoKey: String = "userName"
@objc func didReceiveChangeUserNameNotification(_ noti: Notification) {
guard let name: String = noti.userInfo?[self.userInfoKey] as? String else { return }
self.userName.text = name
}
override func viewDidLoad() {
NotificationCenter.default.addObserver(self, selector: #selector(self.didReceiveChangeUserNameNotification(_:)), name: changeUserNameNotification, object: nil)
}
'iOS > PROJECT' 카테고리의 다른 글
[두깃] 깃허브 유저 정보 확인하기 (2022.04.08) (0) | 2022.04.09 |
---|---|
[두깃] 시작화면 UI (2022.04.07) (0) | 2022.04.07 |
[소리마당 Proj] OX Quiz 구현 (0) | 2021.08.15 |
[소리마당 Proj] 메인화면 구성, 테이블뷰 segue 넘기기 (0) | 2021.07.26 |
[소리마당 Proj] ~런치스크린, 회원가입, 로그인 페이지 구현 (0) | 2021.07.23 |