Ch.4 Silver: Different Background Colors

sun·2022년 1월 15일
0

# Random UIColor Generator

  • 과제 자체는 간단해서 딱히 정리할 내용이 없고, 랜덤으로 UIColor 를 생성하는 아주 간단한 방법을 배워서 그것만 기록! rgba 의 각 값을 랜덤으로 얻는 방식이다...! 출처는 여기
extension UIColor {
    static var random: UIColor {
        UIColor(
            red: .random(in: 0...1),
            green: .random(in: 0...1),
            blue: .random(in: 0...1),
            alpha: 1
        )
    }
}
profile
☀️

0개의 댓글

관련 채용 정보