This file contains hidden or 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
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) |
This file contains hidden or 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 RoutingModule { | |
weak var rootViewController: UIViewController? | |
var navigationController: UINavigationController? { | |
if let navigation = self.rootViewController as? UINavigationController { | |
return navigation | |
} else { | |
return self.rootViewController?.navigationController | |
} |
This file contains hidden or 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
// | |
// WKWebView+Rx.swift | |
// RxGround | |
// | |
// Created by eyemac on 2017. 9. 2.. | |
// Copyright © 2017년 rollmind. All rights reserved. | |
// | |
import WebKit | |
import RxSwift |
This file contains hidden or 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 Foundation | |
import Security | |
public struct SwiftSecurity { | |
public enum SwiftSecurityError: Error { | |
case error(SecStatus) | |
} |
This file contains hidden or 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
#!/bin/bash | |
abort() | |
{ | |
echo >&2 ' ABORTED ' | |
exit 1 | |
} | |
trap 'abort' 0 |
This file contains hidden or 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
let audioContext: UnsafeMutablePointer<AVCodecContext> | |
// プレイするサウンドの基本設定 | |
let audioFormat: AVAudioFormat( | |
commonFormat: .pcmFormatFloat32, | |
sampleRate: Double(audioContext.pointee.sample_rate), | |
channels: 2, // サウンドシステムのoutputチャンネルを超えたらクラッシューが発生されます。 | |
interleaved: false) |
This file contains hidden or 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
typedef struct AVFrame { | |
... | |
uint8_t *data[AV_NUM_DATA_POINTERS]; // AV_NUM_DATA_POINTERS = 8 | |
... |
This file contains hidden or 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
defer { | |
avcodec_send_packet(avctx, NULL) | |
while true { | |
if AVERROR_EOF == avcodec_receive_packet(avctx, frame) { | |
break | |
} | |
} | |
} | |
while 0 <= av_read_frame(avctx, packet) { | |
// avcodec_decode_video2[audio4](...)を下のコードに変更します。 |
This file contains hidden or 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
protocol Castable {} | |
protocol UnsafePointerProtocol: NilLiteralConvertible { | |
associatedtype Memory | |
init(nilLiteral: ()) | |
init<Memory>(_ from: UnsafeMutablePointer<Memory>) | |
init<Memory>(_ from: UnsafePointer<Memory>) | |
var memory: Memory { get } | |
func mutable<M>() -> UnsafeMutablePointer<M> |