Swift 4 Upgrade Error: ‘init(colorLiteralRed:green:blue:alpha:)’ is unavailable
Read OriginalThis article addresses a common compiler error encountered when upgrading to Swift 4: 'init(colorLiteralRed:green:blue:alpha:)' is unavailable. It explains that this initializer is only meant for color literals and provides the correct alternative: UIColor(red:green:blue:alpha:). The fix involves replacing 'colorLiteralRed:' with 'red:' in the initializer call. An example using 204/255 values for red, green, and blue is given. The article is a concise technical tutorial aimed at iOS developers upgrading their Swift code, focusing on a specific API change in the language.
Comments
No comments yet
Be the first to share your thoughts!
Browser Extension
Get instant access to AllDevBlogs from your browser