【文件属性】:
文件名称:Swift-SwiftEither:Swift中理想错误处理的PoC
文件大小:10KB
文件格式:ZIP
更新时间:2021-05-30 19:47:00
Swift
迅捷
Swift 中的任一模式实现
概要
import SwiftEither
// helpers
struct Error {
var reason: String
init ( _ reason : String ) { self . reason = reason }
}
func success ( s : String ) -> Either< String> {
return Either ( success : s)
}
func failure ( s : String ) -> Either< String> {
return Either ( failure : Error (s))
}
// 1. basic use
let x = success ( " foo " )
// x repres
【文件预览】:
Swift-SwiftEither-master
----SwiftEither()
--------SwiftEither.h(513B)
--------Info.plist(826B)
--------Either.swift(3KB)
----SwiftEitherTests()
--------Info.plist(753B)
--------SwiftEitherTests.swift(4KB)
----.travis.yml(35B)
----README.md(2KB)
----Makefile(74B)
----SwiftEither.xcodeproj()
--------xcshareddata()
--------project.pbxproj(14KB)
----.gitignore(495B)