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
extension String { | |
var unicodeIntList: [Int] { | |
self.compactMap { | |
Int(UnicodeScalar(String($0))?.value ?? 0) | |
} | |
} | |
} | |
extension Int { | |
var unicodeString: 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
for file in input/*.pdf; do gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile="output/$(basename "$file")" "$file"; done |
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
//https://qiita.com/taisuke_h/items/f6940ba087404d88b138 | |
struct UserId { | |
let value: String | |
} | |
extension UserId: ExpressibleByStringLiteral { | |
init(stringLiteral value: String) { | |
self = UserId(value: value) | |
} |
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 RxCocoa | |
import RxSwift | |
//@propertyWrapperの定義 | |
@propertyWrapper | |
struct MyState<Value> { | |
let projectedValue: BehaviorRelay<Value> | |
var wrappedValue: Value { | |
get { return projectedValue.value } |
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 | |
//@propertyWrapperの定義 | |
@propertyWrapper | |
struct MyState<Value> { | |
private var value: Value | |
private(set) var projectedValue: PassthroughSubject<Value, Never> = .init() |
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
//------- [準備] -------- | |
protocol FoodProtocol { | |
var name: String { get } | |
var energy: Int { get } | |
} | |
struct Apple: FoodProtocol { | |
var name: String { "Apple" } | |
var energy: Int = 10 |
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 | |
import PlaygroundSupport | |
protocol ViewModelInput { | |
func updateFunc() | |
} | |
protocol ViewModelOutput { | |
var outValue1: AnyPublisher<Int, Never> { get } |
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 | |
import PlaygroundSupport | |
protocol ViewModel { | |
//input | |
//update1はVC側でsink(受信)できてしまう | |
var update1: PassthroughSubject<Void, Never> { get } | |
//update2はVC側でパラメータが代入できてしまう | |
var update2: Published<Void>.Publisher { set get } |
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 | |
enum MosaicSegmentStyle: Int, CaseIterable { | |
case fullWidth = 0 | |
case fiftyFifty | |
case twoThirdsOneThird | |
case oneThirdTwoThirds | |
func getNextMosaicSegmentStyle(retainItems: Int) -> MosaicSegmentStyle { | |
switch retainItems { |
NewerOlder