纯虚类 接口混入类 寄生类
typedef: transformX: (Value) -> U
func transformFun(:value:Value) -> U
基类:
public func map<T>(_ transform: (Element) throws -> T) rethrows -> [T]
public func map<U>(transformX) -> Result<U, Error> {
return flatMap { .success(transform($0)) }
}
public func flatMap<U>(_ transform: (Value) -> Result<U, Error>) -> Result<U, Error> {
return analysis(
ifSuccess: transform,
ifFailure: Result<U, Error>.failure)
}
子类:
flatMap { .success(transform($0)) }
let string = typedData.map {
return "($0.name) : ($0.value.string)"
}