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
// swift-tools-version:4.2 | |
// The swift-tools-version declares the minimum version of Swift required to build this package. | |
import PackageDescription | |
let package = Package( | |
name: "test", | |
dependencies: [ | |
// Dependencies declare other packages that this package depends on. | |
// .package(url: /* package url */, from: "1.0.0"), |
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
public protocol ContentResettable { | |
func resetContents() | |
} |
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 ORSSerial | |
class Delegate: NSObject, ORSSerialPortDelegate { | |
/// 改行が入力されるまでの文字列を格納するテキストバッファ | |
private var textBuffer = "" | |
/// 入力 | |
private func input(_ serialPort: ORSSerialPort) { | |
print("<< ", terminator: "") | |
let input = readLine() ?? "" |
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
# g: git | |
alias g='git' | |
# gs: switch | |
alias gs='git switch' | |
fuction gsi (){ git switch issues/$@ } | |
# gsc: switch with a new branch | |
alias gsc='git switch -c' | |
function gsci (){ git switch -c issues/$@ } |
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 Observable where E == Int { | |
func add(_ value: Int) -> Observable<Int> { | |
return map { $0 + 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
{ | |
"user": { | |
"Name": "Yuto Mizutani" | |
}, | |
"lib": { | |
"lib-name": "JSONtoCodable", | |
"year": 2018, | |
"version": "1.0.2", | |
"released": "2018-09-22" | |
}, |
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 Alamofire | |
class Foo { | |
/// Success handler | |
public typealias SuccessHandler<T> = (_ model: T) -> Void | |
/// Failure handler | |
public typealias FailureHandler = (_ error: Error) -> Void | |
/** |
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
let frame: CGRect = /* foo */ | |
let view: UIView = UIView(frame: frame) | |
let label: UILabel = UILabel(frame: frame) | |
label.text = /* bar */ | |
// ViewにLabelを追加する | |
view.addSubView(label) | |
// CAGradientLayerによるグラデーションの適用 | |
let gradientLayer: CAGradientLayer = CAGradientLayer() |
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
github "ReactiveX/RxSwift" ~> 4.0 |
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
$ swiftc main.swift hello.swift | |
$ ./main |
NewerOlder