-
Notifications
You must be signed in to change notification settings - Fork 520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GameController] Update bindings for Xcode 14 beta 1-5 #15692
[GameController] Update bindings for Xcode 14 beta 1-5 #15692
Conversation
src/gamecontroller.cs
Outdated
[DisableDefaultCtor] | ||
interface GCPhysicalInputElementCollection<KeyIdentifierType, ElementIdentifierType> // : INSFastEnumeration // # no generator support for FastEnumeration - https://bugzilla.xamarin.com/show_bug.cgi?id=4391 | ||
where KeyIdentifierType : IGCPhysicalInputElementName /* NSString */ // there's currently not an conversion from GCPhysicalInputElementName, GCButtonElementName, and GCDirectionPadElementName to NSString | ||
where ElementIdentifierType : IGCPhysicalInputElement |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm having trouble using this interface with all the different protocols that try to use different protocols for the 'KeyIdentifierType': GCPhysicalInputElementName, GCButtonElementName, and GCDirectionPadElementName
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
src/gamecontroller.cs
Outdated
|
||
[Export ("elementForAlias:")] | ||
[return: NullAllowed] | ||
IGCPhysicalInputElement GetElement (string alias); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird, since you have a generic class that is returning the ElementIdentifierType.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
src/gamecontroller.cs
Outdated
float MaximumDegreesOfRotation { get; } | ||
} | ||
|
||
interface IGCAxisElementName {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoever implemented this at Apple found a very complicated solution to something that looks quite simple.
I had a look at the headers, and it seems that these protocols is an attempt to group different NSString values together - basically creating an NSString-based enum of sorts 🤯
In any case, what I think we should do:
- Don't bind any protocols that are defined with
objc_non_runtime_protocol
:
__attribute__((objc_non_runtime_protocol)) NS_REFINED_FOR_SWIFT
@protocol GCPhysicalInputElementName
@end
__attribute__((objc_non_runtime_protocol)) NS_REFINED_FOR_SWIFT
@protocol GCButtonElementName <GCPhysicalInputElementName>
@end
__attribute__((objc_non_runtime_protocol)) NS_REFINED_FOR_SWIFT
@protocol GCAxisElementName <GCPhysicalInputElementName>
@end
__attribute__((objc_non_runtime_protocol)) NS_REFINED_FOR_SWIFT
@protocol GCSwitchElementName <GCPhysicalInputElementName>
@end
__attribute__((objc_non_runtime_protocol)) NS_REFINED_FOR_SWIFT
@protocol GCDirectionPadElementName <GCPhysicalInputElementName>
@end
- For each of these protocols, create a strong enum, and add the fields declared with each protocol to the corresponding enum.
For example:
GAMECONTROLLER_EXTERN GCInputButtonName GCInputButtonA NS_REFINED_FOR_SWIFT API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0));
GAMECONTROLLER_EXTERN GCInputButtonName GCInputButtonB NS_REFINED_FOR_SWIFT API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0));
GAMECONTROLLER_EXTERN GCInputButtonName GCInputButtonX NS_REFINED_FOR_SWIFT API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0));
GAMECONTROLLER_EXTERN GCInputButtonName GCInputButtonY NS_REFINED_FOR_SWIFT API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0));
would become:
enum GCInputButtonName {
[Field ("GCInputButtonA")]
NSString A { get; }
[Field ("GCInputButtonB")]
NSString B { get; }
[Field ("GCInputButtonX")]
NSString X { get; }
[Field ("GCInputButtonY")]
NSString Y { get; }
...
}
@dalexsoto / @chamons what do you think?
The simpler solution is of course to just not bind these protocols for now, and decide later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to agree with @rolfbjarne this is way cleaner! the only thing is that it seems to be already done here as Fields
So probably this is not even needed? Also creating a test case may be the only way to figure out if the API is right. Maybe we can just leave them out, those protocols for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dalexsoto @rolfbjarne
I have removed the protocols that have the 'objc_non_runtime_protocol' attribute!
…code14-GameController-Beta4
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
/azp run |
rekicking due to failing msbuild integration tests |
Azure Pipelines successfully started running 1 pipeline(s). |
💻 [PR Build] Tests on macOS Mac Catalina (10.15) passed 💻✅ All tests on macOS Mac Catalina (10.15) passed. Pipeline on Agent |
✅ API diff for current PR / commitLegacy Xamarin (No breaking changes).NET (No breaking changes)❗ API diff vs stable (Breaking changes)Legacy Xamarin (:heavy_exclamation_mark: Breaking changes :heavy_exclamation_mark:).NET (:heavy_exclamation_mark: Breaking changes :heavy_exclamation_mark:)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
❌ [PR Build] Tests on macOS M1 - Mac Big Sur (11.5) failed ❌Failed tests are:
Pipeline on Agent |
🔥 [CI Build] Test results 🔥Test results❌ Tests failed on VSTS: simulator tests 0 tests crashed, 1 tests failed, 227 tests passed. Failures❌ introspection tests
Html Report (VSDrops) Download Successes✅ bcl: All 69 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
No description provided.