mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-11 05:49:24 +00:00
29 lines
818 B
Swift
29 lines
818 B
Swift
//
|
|
// UIImage+Utils.swift
|
|
// GraphTest
|
|
//
|
|
// Created by Andrei Salavei on 4/8/19.
|
|
// Copyright © 2019 Andrei Salavei. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
extension UIImage {
|
|
static let arrowRight = UIImage(bundleImageName: "Chart/arrow_right")
|
|
static let arrowLeft = UIImage(bundleImageName: "Chart/arrow_left")
|
|
|
|
public convenience init?(color: UIColor, size: CGSize = CGSize(width: 1, height: 1)) {
|
|
let rect = CGRect(origin: .zero, size: size)
|
|
UIGraphicsBeginImageContextWithOptions(rect.size, false, 0.0)
|
|
color.setFill()
|
|
UIRectFill(rect)
|
|
let image = UIGraphicsGetImageFromCurrentImageContext()
|
|
UIGraphicsEndImageContext()
|
|
|
|
guard let cgImage = image?.cgImage else { return nil }
|
|
self.init(cgImage: cgImage)
|
|
}
|
|
|
|
|
|
}
|