Post

Replies

Boosts

Views

Activity

Reply to How to create and manage nested List with NSTextList, NSAttributedString and UI/NSTextView
To use NSTextList, you create a list style and apply it via a NSMutableParagraphStyle to the text range or typing attributes. For dynamic updates: For Selected Text: Modify the NSParagraphStyle of the selected range in the NSTextStorage. For Typing Attributes: Update the typingAttributes of the NSTextView to ensure new text inherits the styles. Avoid manual string attribute merging by working with the paragraph style directly.
Topic: UI Frameworks SubTopic: General Tags:
Dec ’24
Reply to Error Domain=NSCocoaErrorDomain Code=518 "The file couldn’t be saved because the specified URL type isn’t supported."
Your issue is that URL(string:) expects a valid URL with a scheme (like file://), but you're passing a file path directly. It is similar to the following error:ErrorDomain = NsCocoaErrorDomain & ErrorCode = 4 Instead, you should use URL(fileURLWithPath:) for file paths. Here's the fixed code: var tempString = String() for Rezept in alleRezepte { tempString += "\(Rezept.name), \(Rezept.description), \(Rezept.nutrients), \(Rezept.whatToDo)\n" } if let dirs = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first { let path = dirs.appending("/rezepte.csv") let url = URL(fileURLWithPath: path) do { try tempString.write(to: url, atomically: true, encoding: .utf8) print("Daten gesichert") } catch { print("Error saving file: \(error)") } }
Topic: Programming Languages SubTopic: Swift Tags:
Dec ’24
Reply to How to create and manage nested List with NSTextList, NSAttributedString and UI/NSTextView
To use NSTextList, you create a list style and apply it via a NSMutableParagraphStyle to the text range or typing attributes. For dynamic updates: For Selected Text: Modify the NSParagraphStyle of the selected range in the NSTextStorage. For Typing Attributes: Update the typingAttributes of the NSTextView to ensure new text inherits the styles. Avoid manual string attribute merging by working with the paragraph style directly.
Topic: UI Frameworks SubTopic: General Tags:
Replies
Boosts
Views
Activity
Dec ’24
Reply to Unable to update Apple Watch Se from 10.6.1 to Watch OS 11
The Watch app might not show updates because the beta version on your Watch isn't compatible with the iPhone's current software. You might need to unenroll the Watch from the beta program or contact Apple Support for help syncing the software versions.
Topic: Community SubTopic: Apple Developers Tags:
Replies
Boosts
Views
Activity
Dec ’24
Reply to Error Domain=NSCocoaErrorDomain Code=518 "The file couldn’t be saved because the specified URL type isn’t supported."
Your issue is that URL(string:) expects a valid URL with a scheme (like file://), but you're passing a file path directly. It is similar to the following error:ErrorDomain = NsCocoaErrorDomain & ErrorCode = 4 Instead, you should use URL(fileURLWithPath:) for file paths. Here's the fixed code: var tempString = String() for Rezept in alleRezepte { tempString += "\(Rezept.name), \(Rezept.description), \(Rezept.nutrients), \(Rezept.whatToDo)\n" } if let dirs = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first { let path = dirs.appending("/rezepte.csv") let url = URL(fileURLWithPath: path) do { try tempString.write(to: url, atomically: true, encoding: .utf8) print("Daten gesichert") } catch { print("Error saving file: \(error)") } }
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Dec ’24