Day 62, 63, 64, 65, 66, 67 of #100DaysOfSwiftUI

Start 100DaysOfSwiftUI from 2020.Mar.18th.

Day 62, 63, 64, 65, 66, 67: Project 13, part one/two/three/four/five/six
done with 3 hours

New findings: followings are new findings/understanding

  • alert, acitionSheet would be the option for showing dialog to user for asking the selection
  • interoperability between (UI|CG|CI|))Images
    • UIImage to CGImage, CIImage, Image
    • CGImage to UIImage, CIImage, Image
    • CIImage to CGImage
    • Image to ?
    • Image from UIImage, CGImage
    • UIImage from CGImage
    • CGImage from UIImage, CIImage
    • CIImage from UIImage, CGImage
  • UIViewControllerRepresentable is important class for importing UIKit part into SwiftUI
    For it, needs to implement makeUIViewController, updateUIViewController
  • CoreImage is so slow in simulator.

For challenges, I arranged a little.

For 1. I dis-enabled "save" button if no image is there.
And Skipped 3rd challenge, because it looks not so interesting...

Code for challenge 1

Button("Save") {
    guard let processedImage = self.processedImage else { return }

    let imageSaver = ImageSaver()
    imageSaver.successHandler = {
        print("Success!")
    }
    imageSaver.errorHandler = {
        print("Oops: \($0.localizedDescription)")
    }
    imageSaver.writeToPhotoAlbum(image: processedImage)
}
.disabled(self.processedImage == nil)

Code for challenge 3

ActionSheet(title: Text("Current Filter: \(self.currentFilter.name)"), buttons: [

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です