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
class ToastWindow: UIWindow { | |
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { | |
let view = super.hitTest(point, with: event) | |
if view == self { | |
return nil | |
} else { | |
return view | |
} | |
} | |
} |
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 Foundation | |
import zlib | |
struct CRC32: Equatable, ExpressibleByIntegerLiteral, CustomStringConvertible { | |
typealias IntegerLiteralType = UInt32 | |
let value: UInt32 | |
var description: String { String(format: "%08X", value) } | |
init(data: Data) { |
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 Foundation | |
import Combine | |
extension Combine.Publishers { | |
struct Sequencial<Sequence, Output, Failure>: Publisher | |
where | |
Sequence: Swift.Sequence, | |
Sequence.Element: Publisher, | |
Sequence.Element.Output == Output, | |
Sequence.Element.Failure == Failure |
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 Foundation | |
import Combine | |
extension FileManager { | |
struct RemoveItemPublisher: Publisher { | |
typealias Output = Void | |
typealias Failure = Error | |
var url: URL | |
var fileManager: FileManager |
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 Foundation | |
let formatter = DateComponentsFormatter() | |
formatter.unitsStyle = .positional | |
formatter.allowedUnits = [.minute, .second] | |
formatter.zeroFormattingBehavior = .pad | |
formatter.string(from: 61) |
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
zip -0 -r archive.zip source… |
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
#pragma clang diagnostic push | |
#pragma clang diagnostic ignored "-Wunused-value" | |
c.view; | |
#pragma clang diagnostic pop |
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 Foundation | |
// URLQueryValue | |
public enum URLQueryValueCompatibleError: Error { | |
case none // nil | |
case empty // isEmpty | |
case format // 期待した書式ではない | |
} |
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 | |
import Combine | |
// MARK: - UserDefaults | |
public protocol UserDefaultsProtocol: NSObject { | |
func value<Value: UserDefaultCompatible>(type: Value.Type, forKey key: String, default defaultValue: Value) -> Value | |
func setValue<Value: UserDefaultCompatible>(_ value: Value, forKey key: String) | |
} |
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 | |
import Combine | |
// これだけでは使いにくい。 | |
// * 色々な型への対応 | |
// * Property WrapperのprojectedValueとしてCurrentValueSubjectを返す | |
// とすれば使いやすくなるはず。 | |
class Box { | |
var cancelable: AnyCancellable? |
NewerOlder