Skip to content

Instantly share code, notes, and snippets.

View wanbok's full-sized avatar
🎯
Focusing

Wanbok Choi (Wayne) wanbok

🎯
Focusing
View GitHub Profile
@wanbok
wanbok / LeftAlignedFlowLayout.swift
Created October 23, 2018 10:55
UICollectionViewFlowLayout for something like a tag list
//
// LeftAlignedFlowLayout.swift
//
// Created by Wanbok Choi on 19/05/2017
//
import UIKit
final class LeftAlignedFlowLayout: UICollectionViewFlowLayout {
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
//
// EnumCollection.swift
// Created by Wanbok Choi on 2017. 4. 12..
//
protocol EnumCollection: Hashable {
static var iterator: AnyIterator<Self> { get }
static var allValues: [Self] { get }
}
//
// CancelableTapGestureRecognizer.swift
//
// Created by Wanbok Choi on 2017. 5. 4..
//
import UIKit.UIGestureRecognizerSubclass
import RxSwift
import RxCocoa
@wanbok
wanbok / DateTransform.swift
Created May 25, 2017 13:18
Handle 10microseconds with DateFormatter
//
// Created by Wanbok Choi on 2017. 5. 4..
//
import ObjectMapper
import SwiftDate
enum DateFormat: String {
case time = "hh:mm a"
case normal = "yyyy-MM-dd"
@wanbok
wanbok / convert_spliter
Last active February 25, 2017 11:14
ImageMagick image spliter
convert ./* -crop 4x1@ -set filename:fname '%t_%[fx:(page.x/page.width)*4+1]' './%[filename:fname].png'
@wanbok
wanbok / UIViewControllerExtensions.swift
Created August 29, 2016 04:06
TopMostViewController
import UIKit
extension UIViewController {
/// Returns the current application's top most view controller.
public class func topMostViewController() -> UIViewController? {
let rootViewController = UIApplication.sharedApplication().windows.first?.rootViewController
return self.topMostViewControllerOfViewController(rootViewController)
}
@wanbok
wanbok / NSAttributedStringExtension.swift
Created August 16, 2016 06:12
join for NSAttributedString
extension CollectionType where Self.Generator.Element : NSAttributedString {
func join(separator: String? = nil) -> NSAttributedString {
let mutableAttributedString = NSMutableAttributedString()
self.forEach {
if let separator = separator where self.first != $0 {
mutableAttributedString.appendAttributedString(NSAttributedString(string: separator))
}
mutableAttributedString.appendAttributedString($0)
}
@wanbok
wanbok / UISearchControllerDelegateExtension.swift
Created April 25, 2016 06:46
UISearchControllerDelegate
extension ViewController: UISearchControllerDelegate {
func willPresentSearchController(searchController: UISearchController) {
tabBarController?.tabBar.hidden = true
searchBarBackground(true)
dimmingBackground(true)
}
func willDismissSearchController(searchController: UISearchController) {
tabBarController?.tabBar.hidden = false
searchBarBackground(false)
@wanbok
wanbok / CopyableLabel.swift
Last active May 23, 2017 03:39
Copyable UILabel
//
// CopyableLabel.swift
//
// Created by Wanbok Choi on 2016. 3. 17..
//
import UIKit
final class CopyableLabel: UILabel {
//
// MockingServer.swift
// Frip
//
// Created by 최완복 on 2016. 1. 6..
// Copyright © 2016년 Wanbok. All rights reserved.
//
import UIKit
import AMYServer