This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UIColor { | |
convenience init(hex: UInt32, alpha: CGFloat = 1) { | |
let r = CGFloat((hex & 0xFF0000) >> 16) / 255 | |
let g = CGFloat((hex & 0x00FF00) >> 8) / 255 | |
let b = CGFloat(hex & 0x0000FF) / 255 | |
self.init(red: r, green: g, blue: b, alpha: alpha) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@dynamicMemberLookup | |
struct Apply<Base: AnyObject> { | |
private let build: () -> Base | |
private init(_ build: @escaping () -> Base) { | |
self.build = build | |
} | |
init(_ base: Base) { | |
self.build = { base } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class TooltipView: UIView { | |
private var option: Option! | |
init(option: Option) { | |
self.option = option | |
super.init(frame: .zero) | |
configure() | |
} | |
required init?(coder aDecoder: NSCoder) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class AnimationView: UIView { | |
private let shapeLayer: CAShapeLayer = { | |
let it = CAShapeLayer() | |
it.fillColor = UIColor.clear.cgColor | |
it.strokeColor = UIColor(hex: 0xFF598B).cgColor | |
it.lineWidth = 5 | |
it.lineCap = .round | |
it.strokeEnd = 0 | |
return it | |
}() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIView { | |
var layout: LayoutMaker { | |
return LayoutMaker(self) | |
} | |
} | |
protocol CGFloatConvertible { | |
var cgFloatValue: CGFloat { get } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
import 'dart:convert'; | |
import 'package:flutter/cupertino.dart'; | |
import 'package:flutter/foundation.dart'; | |
import 'package:flutter/material.dart'; | |
import 'package:http/http.dart' as http; | |
import 'package:webview_flutter/webview_flutter.dart'; | |
class User { | |
final String id; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class SettingTable: UITableView { | |
typealias SelectHandler = (IndexPath) -> () | |
convenience init(sections: [[String]], onSelectRow: @escaping SelectHandler) { | |
self.init(frame: .zero, style: .grouped) | |
self.sections = sections | |
self.register(UITableViewCell.self, forCellReuseIdentifier: "cell") | |
self.selectHandler = onSelectRow | |
self.delegate = self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class LoadingCircleView: UIView { | |
private var shapeLayer: CAShapeLayer! | |
override func draw(_ rect: CGRect) { | |
let center = CGPoint(x: bounds.width / 2, y: bounds.height / 2) | |
let trackLayer = createTrackLayer(center: center, radius: 100, lineWidth: 10, strokeColor: .darkGray) | |
layer.addSublayer(trackLayer) | |
shapeLayer = createTrackLayer(center: center, radius: 100, lineWidth: 10, strokeColor: .orange) | |
shapeLayer.strokeEnd = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// TableViewExample | |
// | |
// Created by churabou on 2018/11/08. | |
// Copyright © 2018 churabou. All rights reserved. | |
// | |
import UIKit |