UploadPostController.swift에서 프로토콜을 선언해주고 해당 프로토콜을 상속받는 delegate라는 변수를 만들어준다. 이제 해당 delegate를 사용할 곳에서 이렇게 선언을 해주고 이 delegate를 처리할 다른 뷰 컨트롤러에서 이렇게 extension을 사용하여 해당 프로토콜을 상속받고 프로토콜에 전달된 함수를 구현하여 기능을 처리한다.
let gradient = CAGradientLayer() gradient.colors = [UIColor.systemPurple.cgColor, UIColor.systemBlue.cgColor] gradient.locations = [0,1] view.layer.addSublayer(gradient) gradient.frame = view.frame gradient.locations = [0,1]의 숫자를 [0],[0.5]...[1] 이런식으로 변경하면 그라데이션의 효과를 다르게 줄 수 있다.
class FeedController: UICollectionViewController- UITabBarController에 선언되어있는 FeedController은 UICollectionViewController이다 이 상태로 런을 하면 'NSInvalidArgumentException', reason: 'UICollectionView must be initialized with a non-nil layout parameter'같은 에러가 나타난다 UICollectionView는 Nil이 아닌 레이아웃 매개 변수로 초기화해야 하기때문. let layout = UICollectionViewFlowLayout() let feed = templateNavigationController(unselectedIm..