【文件属性】:
文件名称:EitherSwift:Either的实例可以是Left或Right的实例
文件大小:17KB
文件格式:ZIP
更新时间:2021-04-29 00:25:19
Swift
迅捷
表示两个可能类型之一的值(不相交的并集)。 Either的实例是Left或Right的实例。
描述
像这样的Swift Either类型++一些
确定正确投影将是需要的。
要求
Swift 2或更高版本
iOS 8.0或更高版本
用法
struct Error {
var reason: String
init ( _ reason : String ) { self . reason = reason }
}
let resultL = Either < Error> . left ( Error ( " failed " ))
let resultR = Either < Error> . right ( " ok " )
isLeft / isRight
resultR. isRight // true
result
【文件预览】:
EitherSwift-master
----.travis.yml(217B)
----EitherSwift.xcodeproj()
--------project.xcworkspace()
--------project.pbxproj(16KB)
--------xcshareddata()
----EitherSwiftTests()
--------ProjectionTests.swift(6KB)
--------EitherSwiftTests.swift(7KB)
--------Info.plist(756B)
----EitherSwift.podspec(551B)
----EitherSwift()
--------Operators.swift(571B)
--------EitherType.swift(639B)
--------EitherSwift.h(501B)
--------Info.plist(829B)
--------Projection.swift(5KB)
--------Either.swift(7KB)
----.gitignore(717B)
----README.md(5KB)