Post

Replies

Boosts

Views

Activity

Reply to Set filename to use for "Save to Files" with ShareLink?
That kinda helps however, the function that generates the transferrable data is a static function meaning that the filename most appropriate for the data is not available to the wrapper... Also, the new link to that method is: https://developer.apple.com/documentation/coretransferable/transferrepresentation/suggestedfilename(_:)-2yln2
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Nov ’24
Reply to Problem decoding AttributedString containing emoji
So I was putting together a bug report when I realized the reason it was working in macOS was because I was using a web view and not the NSAttributedString. Here is a very simple example that shows the issue that you may be able to find out why it's not converting. It could be in the HTML attributing of the string... import SwiftUI struct ContentView: View { let html = "<html><head><meta name=\"viewport\" content=\"width=device-width\" /></head><body style=\"font-family: -apple-system;color: rgb(255,255,255);\"><p>Feature Answer 5</p><p><strong>This should be bold</strong></p><p><em>This should be italic</em></p><blockquote><p>Happy Christmas emoji should be supported! 🎅🎄🎁 😉</p></blockquote></body></html>" var attributedString: AttributedString { let data = Data(html.utf8) if let attributedString = try? NSAttributedString(data: data, options: [.documentType: NSAttributedString.DocumentType.html], documentAttributes: nil) { return AttributedString(attributedString) } else { return "Unable to pull NSAttributed string from data." } } var body: some View { VStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") Text(attributedString) } .padding() } } #Preview { ContentView() }
Topic: App & System Services SubTopic: General Tags:
Jun ’24
Reply to How do you include custom symbol resources in a package?
Okay, I think I figured it out. Change the .target to be this and it seems to work by calling the bundle version of Image initializers: .target( name: "TestLibrary", resources: [.process("Resources")] ), // test.svg was included as a symbolset Image("test", bundle: Bundle.module) Note that this code only works from within the module so the specific symbol needs to be exposed in Image form rather than as a string.
Topic: Programming Languages SubTopic: Swift Tags:
Apr ’24