-
Feature Request: Add To Swift Package Manager and convert to Swift code from Objective C |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
You can currently use from Swift (corresponding test). No plans to port the code itself to Swift but that shouldn't matter for dependent code. An example would be our Grid Swift library which uses our Simple Features Objective-C library. Not opposed to Swift Package Manager support. We use CocoaPods so hasn't been a priority. I was messing with it a little bit on our TIFF library here, originating from this pull request, bet never followed through. |
Beta Was this translation helpful? Give feedback.
-
@bosborn i got it to load. I have a little question though. i am not sure why it doesnt work the same way in android. i did it like this
but in swift i cant do it like this
says For-in loop requires 'SFGFeatureCollection' to conform to 'Sequence'. it works ok if i do featureCollection.features but then feature has no property bbox unlike in the Android library. what is the equivalent for the ios version? or how to cast feature to any SFGPoint, SFGLineString, SFGPolygon, etc. if i do just featurethe tooltip says self: Any and not SFGFeature. but print(feature) does show it as SFGFeature. thoughts? |
Beta Was this translation helpful? Give feedback.
-
Edit: I got it to work. Though i am confused why it had to be like that.
weird that i have to specify the type in sfgFeature else it errors out. Maybe it is because this is objective c code? sorry, still new to ios. |
Beta Was this translation helpful? Give feedback.
-
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:
|
Beta Was this translation helpful? Give feedback.
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: