swift 开发笔记 30
2018-02-06 18:03 dengchaojie_learner 阅读(150) 评论(0) 编辑 收藏 举报self.performSegue(withIdentifier: "ShowResults", sender: self)
guard let controller = segue.destination as? TagsColorsViewController else {
fatalError("Storyboard mis-configuration. Controller is not of expected type TagsColorsViewController")
}
tableViewController.data = tags.map {
TagsColorTableData(label: $0, color: nil)
}
let photoColors = imageColors.flatMap({ (dict) -> PhotoColor? in
guard let r = dict["r"] as? String,
let g = dict["g"] as? String,
let b = dict["b"] as? String,
let closestPaletterColor = dict["closest_palette_color"] as? String else{
return nil
}
return PhotoColor(red: Int(r), green:Int(g), blue:Int(b),colorName:closestPaletterColor)
})
var path : String {
switch self {
case .content:
return "/content"
case .tags:
return "/tagging"
case .colors:
return "/colors"
}
}
func upload(image:UIImage, progressCompletion: @escaping (_ percent: Float) -> Void, completion: @escaping (_ tags: [String], _ colors:[PhotoColor]) -> Void) -> Void {}