Skip to content

Instantly share code, notes, and snippets.

View takehito-koshimizu's full-sized avatar

Takehito KOSHIMIZU takehito-koshimizu

View GitHub Profile
@takehito-koshimizu
takehito-koshimizu / UIImage+ex.swift
Created November 5, 2018 02:38
UIGraphicsImageRenderer Sample
import UIKit
public extension UIImage {
public static func image(path: UIBezierPath, fillcolor color: UIColor) -> UIImage {
return UIGraphicsImageRenderer(bounds: path.bounds).image { _ in
color.setFill()
path.fill()
}
}
@takehito-koshimizu
takehito-koshimizu / EnumEnumerable.swift
Last active July 23, 2017 07:26
EnumEnumerable for Swift4.0
http://qiita.com/su_k/items/c1c6a91324cf12151256
import Foundation
protocol EnumEnumerable: Hashable {}
extension EnumEnumerable {
private static var iterator: AnyIterator<Self> {
var n = 0
@takehito-koshimizu
takehito-koshimizu / VersionNumber.swift
Last active January 29, 2017 09:12
バージョン番号のラッパ
/// バージョン番号のラッパ
public struct VersionNumber: Comparable,
ExpressibleByStringLiteral,
CustomStringConvertible,
CustomDebugStringConvertible {
/// メジャーバージョン番号
public let major: Int
/// マイナーバージョン番号
public let minor: Int
//
// DeviceVersion.swift
// cw-mwd-iphone
//
// Created by 小清水健人 on 2014/10/07.
//
//
import Foundation
//
// UILabel+Extra.swift
// cw-mwd-iphone
//
// Created by 小清水健人 on 2014/10/13.
//
//
import UIKit
@takehito-koshimizu
takehito-koshimizu / HirakakuLabel.swift
Last active August 29, 2015 14:17
ヒラギノフォントで日本語に英語を混ぜると正しく表示できなるCoreTextのバグ対策のためのカスタムUILabel
import UIKit
import CoreText
/**
ヒラギノフォントで日本語に英語を混ぜると正しく表示できなるCoreTextのバグ対策のためのラベル
*/
class HirakakuLabel: UILabel {
private var ctFont: CTFont! {
return CTFontCreateWithName((font.fontName) as CFStringRef, font.pointSize, nil)