Maccle415
Maccle415

Reputation: 222

How to use NSTextView with Core Data Swift

I am busy creating a small note taking application but I have run into a bit of an issue.

I cannot seem to get an NSTextView to work with core data. I have watched this video https://www.youtube.com/watch?v=qypMqkT20LU and I have also read "Swift development with Cocoa".

"Swift development with Cocoa" uses an nstextview but they are not using core data. From the this book I have gathered that I need to use NSAttributedString for the content of the NSTextView.

The issue that I am having is that I cannot find out how to use that with Core Data.

I am trying to make this app like the video is so that I do not need to use any code but just use pure bindings.

I have also tried using binary data type for the attribute in my entity as well as transformable but then I get an issue where the application cannot start because it cannot find the applications saved data.

Any help would be much appreciated on how to use a NSTextView with core data and bindings.

Upvotes: 0

Views: 356

Answers (1)

Maccle415
Maccle415

Reputation: 222

It turns out that the storedata file that is created when the application launches was not being overwritten, so every time I changed and attribute in the storedata it would break because the attributes were not the same.

To fix this issue I had to delete the storedata every time I ran the app. The file can be found in /Users/{user}/Library/Application\ Support/{app name}

Usually the app name would be com.yourcompany.appname

Upvotes: 0

Related Questions