The DSL builders like PeripheralBuilder are "additive", you can use them to avoid repeated code #968
Unanswered
curioustechizen
asked this question in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Some DSLs have platform-specific "extensions". Some examples:
PeripheralBuilderon Android providesautoConnectIfScannerBuilderon Android providesscanSettingsTo use these features, I use the expect/actual mechanism. However, I find myself repeating the common part of the builders on both platforms.
As you can see, everything is same except for the
scanSettingson Android.I figured out that you can avoid this repetition by accepting by accepting a lambda with receiver of your own and adding your own configuration as follows:
Beta Was this translation helpful? Give feedback.
All reactions