0si43 / PiecesOfPaper

Note app focused on quick sketch by Apple Pencil
https://apps.apple.com/jp/app/like-a-paper/id1511690088#?platform=ipad
MIT License
62 stars 8 forks source link

SwiftUI #36

Closed 0si43 closed 2 years ago

0si43 commented 3 years ago

現状の設計

IMG_01B377058026-1

0si43 commented 3 years ago

Transfer in SwiftUI Canvas → List is good choice

0si43 commented 3 years ago

I plagiarized PKCanvasViewWrapper from below……

https://www.hackingwithswift.com/forums/swiftui/pencilkit-with-swiftui/59

0si43 commented 3 years ago

Will I need this?

https://stackoverflow.com/questions/59430099/pencilkit-in-swiftui

0si43 commented 3 years ago

I could get tap gesture below↓

https://developer.apple.com/documentation/swiftui/tapgesture

0si43 commented 3 years ago

UIMenu in SwiftUI is Menu

https://developer.apple.com/documentation/swiftui/menu?changes=latest_beta

But it's not what I thought

IMG_0869

IMG_22C9E1489F3A-1

0si43 commented 3 years ago

Okay, I need to use UIActivityViewController in SwiftUI I should wrap UIActivityViewController……😩

https://zenn.dev/ariiyu/articles/4835d9542aaa34

0si43 commented 3 years ago

UI got a bit of changed. I think it's OK... It's better callout-like UI, but I cannot find easy way now

IMG_DD8334B3CC86-1

0si43 commented 3 years ago

And I want to introduce LPLinkMetadata for improving preview!

https://qiita.com/ezura/items/6036c6e100599b601482

0si43 commented 3 years ago

I realized needs to conform UIActivityItemSource protocol, but I didn't know how to.

https://stackoverflow.com/questions/57850483/ios13-share-sheet-how-to-set-preview-thumbnail-when-sharing-uiimage

↑I referred this stackOverFlow question, implement like this

extension DelegateBridgeObject: UIActivityItemSource {
    func activityViewControllerPlaceholderItem(_ activityViewController: UIActivityViewController) -> Any {
        return ""
    }

    func activityViewController(_ activityViewController: UIActivityViewController, itemForActivityType activityType: UIActivity.ActivityType?) -> Any? {
        return nil
    }

    func activityViewControllerLinkMetadata(_ activityViewController: UIActivityViewController) -> LPLinkMetadata? {
        let metadata = LPLinkMetadata()
        metadata.title = "Share your note"
        return metadata
    }
}

IMG_E2ECBC30B449-1

Ideally, its image must be shared note, but now, it's difficult for structural problem. Later, I will introduce an architecture.

0si43 commented 3 years ago

Ideally, its image must be shared note, but now, it's difficult for structural problem. Later, I will introduce an architecture.

Maybe, this is hard because I should resize note image.

0si43 commented 3 years ago

LPLinkMetadata is seemed to expect url interface. How to use local image?