firebase / geofire-objc

GeoFire for Objective-C - Realtime location queries with Firebase
MIT License
436 stars 180 forks source link

Event enums don't export to Swift Correctly #28

Closed jcampbell05 closed 8 years ago

jcampbell05 commented 8 years ago

Due to the fact NSEnum isn't used the Event Type enums export to swift as:

public struct GFEventType : RawRepresentable, Equatable {
    public init(_ rawValue: UInt32)
    public init(rawValue: UInt32)
    public var rawValue: UInt32
}
wasappi commented 8 years ago

+1 Makes the GFQuery observers unusable for the moment

jcampbell05 commented 8 years ago

This is the code to make it somewhat usable.

public extension GFQuery {

    //Enum for compatibility with Geofire's Obj-C Interface
    enum EventType: UInt32
    {
        case Entered = 0
        case Exited
        case Moved
    }
}

You then have to use it like so:

let type = GFEventType(rawValue: eventType.rawValue)

ref.observeEventType(type)
{
//Block code
}

Would be 200% better if we didn't need this work around :)

jwngr commented 8 years ago

@jdimond / @mcdonamp - Can either of you please provide some feedback here?

rursache commented 8 years ago

is also queryAtLocation affected by this? im trying the basic implementation but i get no response

asciimike commented 8 years ago

@iPhoNewsRO the issue here is that the enums aren't exported correctly in Swift--it shouldn't affect the API responses if the enums exist. Is the issue that you can't get the method to work (as in it doesn't compile), or that it compiles but doesn't return what you expect?

We're taking a look into exporting the correct enums using NSEnum--as always, PRs are welcome :)

rursache commented 8 years ago

it compiles but doesn't return what i expect. probably i'll just need help implementing this

asciimike commented 8 years ago

Ok, then it's not related to this. StackOverflow or our Google Group might be good places to start looking for similar problems, and if you can't find anything posting there asking for help would good.

asciimike commented 8 years ago

Ok, should be solved in #29. Might be a few days before we merge it, and then get it out to Cocoapods. Since NS_ENUM is backwards compatible, I believe this will be 1.1.3.

ricardosobral commented 8 years ago

Would be useful to get either this asap in an interim or know when 1.1.3 is coming out. Tks. Quite unusable in iOS without these enums.

jwngr commented 8 years ago

Sorry about that! We will get 1.1.3 out on Monday.

asciimike commented 8 years ago

Hey folks--hold up on the release with some CocoaPods issues, so it might still be a few days. That said, the code is merged and the v1.1.3 branch exists, so you can use:

pod 'Geofire', :git => 'https://github.com/firebase/geofire-objc.git', :tag => 'v1.1.3'

Thanks!

jwngr commented 8 years ago

Version 1.1.3 has been released to CocoaPods. Thanks for your patience. Let us know if you run into any issues with the latest bits!