Skip to content

7glyphs/image-color-swift

 
 

Repository files navigation

License Build Status codecov.io

UIImage+Color.swift

An iOS helper class for creating a UIImage from a UIColor.

Dependencies

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate UIImageColorSwift into your Xcode project using CocoaPods, specify it in your Podfile:

platform :ios, '8.3'

use_frameworks!

pod 'UIImageColorSwift', '~> 1.0.1'

Then, run the following command:

$ pod install

Manually

  • Add the UIImage+Color.swift file from the Sources folder to your Xcode project.

Usage

For creating a UIImage from a UIColor

let image = UIImage.imageFromColor(UIColor.blue)

// Applying the image to the background of a UIButton

button.setBackgroundImage(image, forState: .normal)

To specify the size of the image:

let image = UIImage.imageFromColor(UIColor.blue, width: 1.0, height: 2.0)

Contributing

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. See the Code of Conduct file.

Maintainers

License

UIImageColorSwift is released under the MIT License. See License.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 91.7%
  • Ruby 8.3%