Post

Replies

Boosts

Views

Activity

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 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