• Stars
    star
    118
  • Rank 298,147 (Top 6 %)
  • Language
    Swift
  • License
    MIT License
  • Created over 7 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

YJExtensions

YJExtensions

Travis branch Language CocoaPods CocoaPods Carthage Compatible GitHub tag license

YJExtensions 常用扩展集合

Adding YJSwiftExtensions to your project (添加 YJSwiftExtensions 到你的项目)

CocoaPods

  1. Add a pod entry for YJSwiftExtensions to your Podfile
    pod 'YJSwiftExtensions'
  1. Install the pod(s) by running
    pod install
  1. Include YJSwiftExtensions wherever you need it with
    import YJSwiftExtensions

Carthage

  1. Add YJSwiftExtensions to your Cartfile.
    github "YJManager/YJSwiftExtensions"
  1. Run
    carthage update
  1. Follow the rest of the standard Carthage installation instructions to add YJSwiftExtensions to your project.

Example举例:

由颜色生成图片

/// 颜色生成图片
public static func yj_createImage(_ color: UIColor) -> UIImage? {

let rect = CGRect(x: 0.0, y: 0.0, width: 1.0, height: 1.0)
UIGraphicsBeginImageContext(rect.size)
let context = UIGraphicsGetCurrentContext()
context?.setFillColor(color.cgColor)
context?.fill(rect)
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image ?? nil
}