Core-fetchString¶
/// 获取指定路径的字符串
///
/// - Parameters:
/// - path: JSON数据路径 (默认为模型数据路径)
/// - keys: 目标数据子路径 (例: [0, "_id"])
/// - Returns: 指定路径的字符串
func fetchString(path: String? = nil, keys: [JSONSubscriptType] = []) -> String
Response转换为String
path指定取值路径,可以设置多级,如retBody>name,如果为nil,则取当前Response下ModelableParameterType的modelKeykey在path的前提下,再指定详细的取值路径,可为Int或String
ps: 当前Response 的 ModelableParameterType 可以通过 MoyaMapperPlugin 进行统一设置
Example¶

let name = response.fetchString(path: "retBody>name")
print("name -- \(name)")
// name -- MoyaMapper

let github = response.fetchString(path: "retBody", keys: [1, "github"])
print("github -- \(github)")
// github -- https://github.com/LinXunFeng/RxSwiftDemo