Skip to content

Instantly share code, notes, and snippets.

View oozoofrog's full-sized avatar

oozoofrog oozoofrog

View GitHub Profile
@oozoofrog
oozoofrog / SwiftSecurity
Last active April 9, 2017 02:49
swift Security status
import Foundation
import Security
public struct SwiftSecurity {
public enum SwiftSecurityError: Error {
case error(SecStatus)
}
//
// WKWebView+Rx.swift
// RxGround
//
// Created by eyemac on 2017. 9. 2..
// Copyright © 2017년 rollmind. All rights reserved.
//
import WebKit
import RxSwift
final class RoutingModule {
weak var rootViewController: UIViewController?
var navigationController: UINavigationController? {
if let navigation = self.rootViewController as? UINavigationController {
return navigation
} else {
return self.rootViewController?.navigationController
}
extension WKNavigationType: CustomStringConvertible {
public var description: String {
switch self {
case .backForward: return "backForward"
case .formResubmitted: return "formResubmitted"
case .formSubmitted: return "formSubmitted"
case .linkActivated: return "linkActivated"
case .other: return "other"
case .reload: return "reload"
@oozoofrog
oozoofrog / XCTRxHandle
Last active May 2, 2018 05:44
aysynchronous Rx Observable test handle function
public func XCTRxHandle<Element>(_ description: String = "XCTAssertForRx", testcase: XCTestCase, timeout: TimeInterval = 1, queue: DispatchQueue = DispatchQueue(label: "Rx queue"), observable: Observable<Element>, trigger: @autoclosure @escaping () -> Void = {}(), value onNext: @escaping (Element?) -> Void = { _ in }, completed: @autoclosure @escaping () -> Void = {}(), error onError: @escaping (Error?) -> Void = { _ in }, result: (XCTWaiter.Result) -> Void = { _ in } ) {
let expect = testcase.expectation(description: description)
expect.assertForOverFulfill = false
let bag = DisposeBag()
queue.async {
observable.subscribe({ (event) in
switch event {
case .error(let error):
onError(error)
@oozoofrog
oozoofrog / 테스트케이스
Last active May 4, 2018 03:02
XCTRxHandle 테스트 케이스
let scheduler = ConcurrentDispatchQueueScheduler.init(qos: DispatchQoS.userInteractive)
let a = Observable<Int>.just(3).delay(3, scheduler: scheduler).debug("A")
let b = Observable<Int>.just(2).delay(2, scheduler: scheduler).debug("B")
// observable의 stream은 3을 전달. error 없음, XCTWaiter.Result는 completed
XCTRxHandle(testcase: self, timeout: 5, observable: a, value: {
XCTAssertEqual($0, 3)
}, error: {
XCTAssertNil($0)
}, result: {
XCTAssertEqual($0, .completed)
@oozoofrog
oozoofrog / BeAddible
Created May 16, 2018 22:07
protocol, generic, extension, conditional conformance
struct Be<Value> {
let value: Value
}
protocol BeAddible {
var be: Be<Self> { get }
}
extension Be where Value: Comparable {
@oozoofrog
oozoofrog / keybase.md
Created September 21, 2018 02:08
keybase.md

Keybase proof

I hereby claim:

  • I am rollmind on github.
  • I am rollmind (https://keybase.io/rollmind) on keybase.
  • I have a public key ASDHVKuqfnxsGNBCmHuUiLoLqU4GdFa6tJUiK3tKYF95vgo

To claim this, I am signing this object:

@oozoofrog
oozoofrog / gist:07d7eec63750c4992b09e2709f180497
Last active July 23, 2024 09:52
한글 유니코드 다루기
import Cocoa
var str = "궉토abcd스234꾹타ㅎ하후훼의"
extension Collection {
var toArray: [Element] {
return Array(self)
}
}
protocol UnicodeScalarCreatable {

Debugging the Swift Toolchain

Use these steps to debug components of the Swift toolchain. This allows you to see Swift's source code from the debugger – instead of disassembly. The debugger can also provide some variable names and values. This has been initially tested with libswiftCore.dylib.

These instructions were updated as of Swift 5.2.1.

Prerequisites