Post

Replies

Boosts

Views

Activity

Reply to SwiftUI view printout on paper
Got it working. I wrapped my SwiftUI View to be printed(and displayed) in a local function like this: private func generateView() -> some View { VStack { .... } } Then I created a func to save the some View as a PDF in the document directory using ImageRenderer. The func also returns the PDF's URL which was created using URL.documentsDirectory.appending(path:) Then I created another func using UIPrintInteractionController and the PDF's URL to present the print controller for the saved pdf.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’24
Reply to SwiftUI view printout on paper
Got it working. I wrapped my SwiftUI View to be printed(and displayed) in a local function like this: private func generateView() -> some View { VStack { .... } } Then I created a func to save the some View as a PDF in the document directory using ImageRenderer. The func also returns the PDF's URL which was created using URL.documentsDirectory.appending(path:) Then I created another func using UIPrintInteractionController and the PDF's URL to present the print controller for the saved pdf.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’24
Reply to xib file
After selecting Xcode's menu File->New->File, select View in the User Interface group. View will create a .xib file. (This applies to iOS, MacOS and TVOS but not WatchOS.)
Replies
Boosts
Views
Activity
Jun ’22