Skip to content

Instantly share code, notes, and snippets.

View iamchiwon's full-sized avatar
💭
I'm awake

Song Chiwon iamchiwon

💭
I'm awake
View GitHub Profile
import RIBs
import RxSwift
import RxRelay
import ReactorKit

protocol FAQsRouting: ViewableRouting {
  func routeToFAQ(_ faq: FAQ)
  func detachFAQ()
}
@iamchiwon
iamchiwon / cloudSettings
Last active May 20, 2020 11:21
VS Code Settings
{"lastUpload":"2020-05-20T11:21:56.191Z","extensionVersion":"v3.4.3"}
@iamchiwon
iamchiwon / Rx+Codable.swift
Created November 22, 2019 12:14
RxSwift extension for Codable
import RxSwift
extension ObservableType {
public func mapObject<T: Codable>(type: T.Type) -> Observable<T> {
return flatMap { (data) -> Observable<T> in
if let data = (data as? (HTTPURLResponse, Data))?.1 {
return try self.mapObject(type: type, data: data)
} else if let json = (data as? (HTTPURLResponse, Any))?.1 {
return try self.mapObjectJSON(type: type, json: json)
} else {
@iamchiwon
iamchiwon / PandaExtension.swift
Last active October 1, 2019 20:26
Panda UIView Extension
import Closures
import Panda
import RxCocoa
import RxSwift
import SnapKit
import UIKit
extension PandaChain where Object: UIView {
@discardableResult
func add(to parent: UIView) -> PandaChain {
@iamchiwon
iamchiwon / os_log_example.swift
Created August 27, 2019 08:02
os_log 를 타입별로 구분해서 사용하기
extension OSLog {
private static var subsystem = Bundle.main.bundleIdentifier!
static let ui = OSLog(subsystem: subsystem, category: "UI")
static let network = OSLog(subsystem: subsystem, category: "Network")
}
os_log("Contact selected", log: .ui)
os_log("HTTP response: %@", log: .network, responseCode)
@iamchiwon
iamchiwon / statusHeight.kt
Created July 19, 2019 06:32
[Android] statusHeight 얻기
onCreate() {
if (Build.VERSION.SDK_INT >= 21) {
windowInsetsRelay = PublishRelay.create();
RelativeLayout base = findViewById(R.id.navi_activity_base);
base.requestApplyInsets();
base.setOnApplyWindowInsetsListener((v, insets) -> {
windowInsetsRelay.accept(insets);
return insets.consumeSystemWindowInsets();
});
}
@iamchiwon
iamchiwon / Timer+Combine.swift
Created July 1, 2019 14:40
RxToCombine: Timer example
//
// ViewController.swift
// RxToCombine
//
// Copyright © 2019 iamchiwon. All rights reserved.
//
import Combine
import UIKit
@iamchiwon
iamchiwon / CombineLatest.swift
Created July 1, 2019 14:10
RxToCombine: combineLatest example
//
// ViewController.swift
// RxToCombine
//
// Copyright © 2019 iamchiwon. All rights reserved.
//
import Combine
import UIKit
@iamchiwon
iamchiwon / TextFieldEvent+Combine.swift
Last active June 27, 2019 15:55
RxToCombine: UITextField editingChanged Example
//
// ViewController.swift
// RxToCombine
//
// Copyright © 2019 iamchiwon. All rights reserved.
//
import Combine
import RxCocoa
import RxSwift
@iamchiwon
iamchiwon / CancelBag.swift
Created June 27, 2019 05:07
CancelBag for combine framework that works like DisposeBag of RxSwift
class CancelBag {
private var bag: [Cancellable] = []
private var named: [String: Cancellable] = [:]
func cancelAll() {
bag.forEach { $0.cancel() }
bag = []
named.forEach { $0.value.cancel() }
named = [:]