How to make a file save on Xcode?

Discussion in 'Mac Programming' started by OSX Buddy, Apr 19, 2014.

  1. OSX Buddy macrumors newbie

    Joined:
    Mar 14, 2014
    #1
    Hello! I am new to Xcode Coding. And i wonder, how to make an app like text edit where you go to the menubar and press: File/Save or Save as
    And file/open or open recent.
    And it would make a file with your own extension (the text edit one is .txt)
    Then the app could open that
    How would I make that?

    P.S Remember the code tags ;)
     
  2. Red Menace macrumors 6502

    Joined:
    May 29, 2011
    Location:
    Littleton, Colorado, USA
    #2
  3. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #3
    I'd like to point out that .txt isn't a file format unique to TextEdit, but a common file format used by numerous text editting programs on numerous platforms, including but not limited to:
    TextEdit
    Notepad
    Notepad++
    gEdit
    Sublime Text
    TextWrangler
    BBEdit

    Also, numerous IDEs and Word Processors can open them, including Xcode and Word.
     
  4. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #4
    It's not a format at all actually, .txt just indicates that the file contains plain text what ever that means.
     
  5. OSX Buddy thread starter macrumors newbie

    Joined:
    Mar 14, 2014
    #5
    Yeah but on some apps, it just has another extension like in ibooks author, it has an extension of .iba

    ----------

    I can't find the save and load script :confused:
     
  6. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #6
    .iba is a proper file format, and also a proprietary Apple format. txt is no format at all, the file contains nothing but content, just pure text.
     
  7. Red Menace macrumors 6502

    Joined:
    May 29, 2011
    Location:
    Littleton, Colorado, USA
    #7
    Not sure what you mean by "script", but the various menu and document actions are typically connected to methods that use NSOpenPanel and NSSavePanel to specify files to use to, well, open and save. The actual reading from and writing to a file would depend on the particular application and whatever document or data types and encodings it is using.
     
  8. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #8
    I'm not sure that your argument makes sense... How is a text file different from a binary, if not by the format?
     
  9. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #9
    Binary data can also be stored without any file format, in a raw form. A file format is an agreed upon standard on how data is stored and laid out in the file.
     
  10. gnasher729 macrumors P6

    gnasher729

    Joined:
    Nov 25, 2005
    #10
    Which makes it a file format, just a very simple one.
     
  11. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #11
    I disagree because there is no information about locale and character encoding, if you compare to some other text formats, say csv, at least there is an idea of layout, or a script file with a #! which could be regarded as a form of "header".
     
  12. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #12
    On another note, the original poster isn't asking how to make a file save on Xcode, but how to make a program which saves files.

    To which I ask, in which language and with what frameworks?
     

Share This Page