Skip to content

Commit

Permalink
Merge pull request #72 from vincentneo/fix/71
Browse files Browse the repository at this point in the history
Fix for #71
  • Loading branch information
vincentneo committed Mar 10, 2020
2 parents 04c8a65 + 914b4e5 commit dedf08b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
4 changes: 1 addition & 3 deletions Classes/GPXExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ public final class GPXExtensions: GPXElement, Codable {
init(raw: GPXRawElement) {
super.init()
for child in raw.children {
let tmp = GPXExtensionsElement(name: child.name)
tmp.text = child.text
tmp.attributes = child.attributes
let tmp = GPXExtensionsElement(raw: child)
children.append(tmp)
}

Expand Down
14 changes: 14 additions & 0 deletions Classes/GPXExtensionsElement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ open class GPXExtensionsElement: GPXElement, Codable {
}
}

/// For initializing with a raw element. Parser use only.
///
/// - Parameters:
/// - raw: parser's raw element
init(raw: GPXRawElement) {
self.name = raw.name
self.text = raw.text
self.attributes = raw.attributes
for child in raw.children {
let tmp = GPXExtensionsElement(raw: child)
self.children.append(tmp)
}
}

/// Initialize with a tagName.
public init(name: String) {
self.name = name
Expand Down
1 change: 1 addition & 0 deletions Example/GPXKit/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class ViewController: UIViewController {
let urlString : String = "https://raw.githubusercontent.com/gps-touring/sample-gpx/master/BrittanyJura/Courgenay_Ballon-DAlsace.gpx"
let url: URL = URL(string: urlString)!


// GPXRoot object that contains all the data parsed from GPXParser.
guard let gpx = GPXParser(withURL: url)?.parsedData() else { return }

Expand Down
1 change: 0 additions & 1 deletion Example/Pods/Pods.xcodeproj/project.pbxproj

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dedf08b

Please sign in to comment.