Skip to content

Commit ccdb606

Browse files
committed
fix: align with obj-c convention
1 parent 53d1235 commit ccdb606

4 files changed

Lines changed: 8 additions & 12 deletions

File tree

apps/AppleApp/Brownfield Apple App/BrownfieldAppleApp.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class RNNavigationDelegate: BrownfieldNavigationDelegate {
2525
present(SettingsScreen())
2626
}
2727

28-
public func navigateToReferrals(userId: String) {
28+
public func navigateToReferrals(_ userId: String) {
2929
present(ReferralsScreen(userId: userId))
3030
}
3131

apps/RNApp/ios/Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
PODS:
22
- boost (1.84.0)
3-
- BrownfieldNavigation (1.0.0):
3+
- BrownfieldNavigation (3.0.0):
44
- boost
55
- DoubleConversion
66
- fast_float
@@ -2803,7 +2803,7 @@ EXTERNAL SOURCES:
28032803

28042804
SPEC CHECKSUMS:
28052805
boost: 7e761d76ca2ce687f7cc98e698152abd03a18f90
2806-
BrownfieldNavigation: 3141ebc18a1dbeb374fff7ae12b2f5d9d1272f2f
2806+
BrownfieldNavigation: 12a34a451661d8f685beebab19d4ba7b43efc409
28072807
Brownie: 981350e32e072e5b55b624eb8810ba9bbc9683d9
28082808
DoubleConversion: cb417026b2400c8f53ae97020b2be961b59470cb
28092809
fast_float: b32c788ed9c6a8c584d114d0047beda9664e7cc6

docs/docs/docs/api-reference/brownfield-navigation.mdx/native-integration.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public final class RNNavigationDelegate: BrownfieldNavigationDelegate {
5656
present(SettingsScreen())
5757
}
5858

59-
public func navigateToReferrals(userId: String) {
59+
public func navigateToReferrals(_ userId: String) {
6060
present(ReferralsScreen(userId: userId))
6161
}
6262

packages/cli/src/navigation/generators/ios.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ export function generateSwiftDelegate(methods: MethodSignature[]): string {
5050
const protocolMethods = methods
5151
.map((method) => {
5252
const params = method.params
53-
.map((param) => {
53+
.map((param, index) => {
5454
const swiftType = mapTsTypeToSwift(param.type, param.optional);
55-
return `${param.name}: ${swiftType}`;
55+
const label = index === 0 ? '_' : param.name;
56+
return `${label} ${param.name}: ${swiftType}`;
5657
})
5758
.join(', ');
5859

@@ -124,8 +125,7 @@ function generateSyncObjCMethod(method: MethodSignature): string {
124125
if (params.length > 0) {
125126
delegateCall += params
126127
.map((param, index) => {
127-
const label =
128-
index === 0 ? `With${capitalizeFirst(param.name)}` : param.name;
128+
const label = index === 0 ? '' : param.name;
129129
return `${label}:${param.name}`;
130130
})
131131
.join(' ');
@@ -167,7 +167,3 @@ function generateAsyncObjCMethod(method: MethodSignature): string {
167167
reject(@"not_implemented", @"${name} is not implemented", nil);
168168
}`;
169169
}
170-
171-
function capitalizeFirst(value: string): string {
172-
return value.charAt(0).toUpperCase() + value.slice(1);
173-
}

0 commit comments

Comments
 (0)