-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/packages
#2304Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterp: pigeonrelated to pigeon messaging codegen toolrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.
Description
Use case
PR flutter/packages#976 has added Swift support, but there is no way to control the naming of a function like there is for ObjC (the annotation @ObjCSelector).
This is important, once Swift functions could be read like a sentence, using labels parameters.
Using the same annotation makes no sense because it is a different language, as well as Swift hasn't selectors concept.
Proposal
I propose creating a new annotation for it. The behavior would be similar to @ObjCSelector.
I don't know the best naming for it. But, just for example, I am using @SwiftFunction.
This interface in Dart
@HostApi()
abstract class Api {
@SwiftFunction('getString(for:)')
String? getString(String key);
@SwiftFunction('setString(_:for:)')
void setString(String value, String key);
@SwiftFunction('remove(key:)')
void remove(String key);
}would generate this protocol in Swift
protocol Api {
func getString(for key: String) -> String?
func setString(_ value: String, for key: String)
func remove(key: String)
}Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterp: pigeonrelated to pigeon messaging codegen toolrelated to pigeon messaging codegen toolpackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.