Question

I am new to Xcode 5 and I want to create a document based application that loads my file (a basic text file with the extension .rt) into an NSTextView and allows me to save the contents of the NSTextView to the file

  1. Is this the right way to set it up?: My app setup

  2. Will I need to use the functions

    -(NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError;

    -(BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError;

3.Are there any basic tutorials that show how to do this in Xcode 5? Most of the tutorials that I have found show how to do this in 10.4<

Was it helpful?

Solution

  1. That looks fine so far as it goes.

  2. You'll need to provide some way to store and retrieve the document's data. -readFromData:of type:error: is one way, but there are also methods that read from a file wrapper or an URL that yo can implement instead.

  3. I don't know of any off the top of my head, and questions seeking resources are generally off topic here. However, Apple's documentation is pretty solid. If you have trouble understanding how to do something, why not ask a question about how to solve that problem rather than searching for step-by-step instructions? Also, Xcode is just a development environment -- most of the information in tutorials written for Xcode 4 should be pretty easy to map to Xcode 5 if you understand what they're trying to accomplish rather than just following the pictures.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top