GPXFileManager

class GPXFileManager : NSObject

Class to handle actions with GPX files (save, delete, etc..)

It works on the default document directory of the app.

  • Folder that where all GPX files are stored

    Declaration

    Swift

    class var GPXFilesFolderURL: URL { get }
  • Gets the list of .gpx files in Documents directory ordered by modified date

    Declaration

    Swift

    class var fileList: [GPXFileInfo] { get }
  • Provides the URL in the GPXFilesFolderURL for the filename provided as argument.

    Declaration

    Swift

    class func URLForFilename(_ filename: String) -> URL

    Parameters

    filename

    gpx filename with .gpx extension (f.i: hola.gpx) or without extension (f.i: hola)

  • Returns true if the file with filename exists on the default folder (GPXFilesFolderURL). False in othercase.

    Declaration

    Swift

    class func fileExists(_ filename: String) -> Bool

    Parameters

    filename

    Name of the file without extension.

  • Saves the GPX contents to the specified URL

    Declaration

    Swift

    class func saveToURL(_ fileURL: URL, gpxContents: String)

    Parameters

    fileURL

    destination URL, basically it is file path.

    gpxContents

    String with the contents to be saved. The XML contents of the GPX file

  • Saves in the default folder the filename with the gpxContents

    Declaration

    Swift

    class func save(_ filename: String, gpxContents: String)

    Parameters

    filename

    gpx filename with .gpx extension (f.i: hola.gpx) or without extension (f.i: hola)

    gpxContents

    String with the contents to be saved. The XML contents of the GPX file

  • Moves temporary files received from Apple Watch app to default directory

    Declaration

    Swift

    class func moveFrom(_ fileURL: URL, fileName: String?)

    Parameters

    fileURL

    URL of temporary file that should be moved/saved.

    fileName

    name of temporary file, including the file extension (.gpx)

  • Removes a file on the specified URL

    Declaration

    Swift

    class func removeFileFromURL(_ fileURL: URL)
  • Removes file on the default directory for GPX files

    Declaration

    Swift

    class func removeFile(_ filename: String)

    Parameters

    filename

    gpx filename with .gpx extension (f.i: hola.gpx) or without extension (f.i: hola)

  • Removes all files on the application temporary directory (NSTemporaryDirectory())

    Declaration

    Swift

    class func removeTemporaryFiles()

Private