• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Store a file vs create on the fly?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Store a file vs create on the fly?


  • Subject: Re: Store a file vs create on the fly?
  • From: Uli Kusterer <email@hidden>
  • Date: Thu, 20 Jan 2011 11:21:18 +0100

On Jan 19, 2011, at 2:30 AM, Jeremy Matthews wrote:
> So I have a simple app which, in essence, creates a text file with some items determined by the user (kind of like an old-fashioned Mad Libs page). Most of the file does not change...I just change a few portions based upon checkbox states, textfield contents, etc. Question is: should I have that file pre-created within the app bundle, load it, make changes, and save out? Or, should I store the text in some strings within code and just write out the file when needed?

 I usually do the former. Strings in code are awkward to edit (escaping line breaks and breaking strings onto multiple lines), so I usually just create a text file, put in some placeholder that I can search for and replace, then load the thing into an NSMutableString, search & replace, write it where it should end up.

 Also, if you have comments or other localizable data in the template you can take advantage of the built-in localization facilities more easily.

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Store a file vs create on the fly?
      • From: Conrad Shultz <email@hidden>
References: 
 >Store a file vs create on the fly? (From: Jeremy Matthews <email@hidden>)

  • Prev by Date: Sending multiple files via Bluetooth using GameKit
  • Next by Date: Re: Sending multiple files via Bluetooth using GameKit
  • Previous by thread: Re: Store a file vs create on the fly?
  • Next by thread: Re: Store a file vs create on the fly?
  • Index(es):
    • Date
    • Thread