Skip to content

Feature Request: Add To Swift Package Manager And Convert to Swift Code #2

Answered by bosborn
chitgoks asked this question in Q&A
Discussion options

You must be logged in to vote

Yeah that works. Objective-c code doesn't conform to the Swift Sequence protocol. Looping over the SFGeometry typed NSMutableArray requires that extra type information.

Two alternates:

for feature in featureCollection.features where feature is SFGFeature {
    let bbox = (feature as! SFGFeature).bbox
}
for feature in featureCollection.features {
    if let sfgFeature = feature as? SFGFeature {
        let bbox = sfgFeature.bbox
    }
}

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by chitgoks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants