SHColor
Overview
Convert hexadecimal string to UIColor with r g b value.
For example :)
FFAA 02 => UIColor
Installation
Cocoapods
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate GMSDirection into your Xcode project using CocoaPods, specify it in your Podfile
:
vi ./Podfile
If you do not have the google map SDK for iOS
target 'MyApp' do
pod 'SHColor'
end
Then, run the following command:
$ pod setup
$ pod install
Use it
Via SSH: For those who plan on regularly making direct commits, cloning over SSH may provide a better experience (which requires uploading SSH keys to GitHub):
$ git clone [email protected]:keisukeYamagishi/SHColor.git
Via https: For those checking out sources as read-only, HTTPS works best:
$ git clone https://github.com/keisukeYamagishi/SHColor.git
Sample code
self.view.backgroundColor = UIColor(hex: "5AC8FA")
Even if the prefix has a #, you can convert it.
self.view.backgroundColor = UIColor(hex: "#5AC8FA")
self.view.backgroundColor = UIColor(hex: "#5ac8fa")
Passing an invalid character string returns 0.
self.view.backgroundColor = UIColor(hex: "#😏😏😏😏😏😏")