\[GCDevicePhysicalInputStateDiff.changedElements nextObject\] keeps returning the same value over and over

20 views Asked by At

I'm trying to implement the GameController framework in Objective-C and I hit a bit of a roadblock as I don't understand why can't I just iterate over changed inputs. The loop never ends and NSEnumerator should eventually return nil no?

GCController.current.input.inputStateAvailableHandler = ^(id<GCDevicePhysicalInput> state) {
    id<GCDevicePhysicalInputState, GCDevicePhysicalInputStateDiff> diff;
    while((diff = [state nextInputState])) {
        id<GCPhysicalInputElement> element;
        while(element = [diff.changedElements nextObject]) {
            // this loop never ends and element is always the same object;
        }
    }
}

0

There are 0 answers