Skip to content

Commit 21390d0

Browse files
committed
2.3.0-1.10.0-rc02-3
- Improves swiftformat from the output swift files
1 parent 9395bd3 commit 21390d0

3 files changed

Lines changed: 20 additions & 13 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public struct ComposeSimpleViewRepresentable: UIViewControllerRepresentable {
120120
ComposeSimpleViewUIViewController().make()
121121
}
122122

123-
func updateUIViewController(_ uiViewController: UIViewController, context _: Context) {
123+
func updateUIViewController(_: UIViewController, context _: Context) {
124124
// unused
125125
}
126126
}
@@ -167,7 +167,7 @@ public struct ComposeAdvancedViewRepresentable: UIViewControllerRepresentable {
167167
ComposeAdvancedViewUIViewController().make(callback: callback)
168168
}
169169

170-
func updateUIViewController(_ uiViewController: UIViewController, context _: Context) {
170+
func updateUIViewController(_: UIViewController, context _: Context) {
171171
ComposeAdvancedViewUIViewController().update(viewState: viewState)
172172
}
173173
}

kmp-composeuiviewcontroller-ksp/src/main/kotlin/com/github/guilhe/kmp/composeuiviewcontroller/ksp/Processor.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,13 @@ internal class Processor(
352352
${composable.name()}UIViewController${if (swiftExportEnabled) ".shared" else "()"}.make($makeParametersParsed)
353353
}
354354
355-
public func updateUIViewController(_ uiViewController: UIViewController, context _: Context) {
355+
public func updateUIViewController(_: UIViewController, context _: Context) {
356356
// unused
357357
}
358358
}
359359
""".trimIndent()
360360
val indentedCode = indentParameters(indentParameters(code, frameworks), letParameters)
361-
val updatedCode = if (letParameters.isEmpty()) removeEmptyLineBetweenStructAndFunc(indentedCode) else indentedCode
361+
val updatedCode = (if (letParameters.isEmpty()) removeEmptyLineBetweenStructAndFunc(indentedCode) else indentedCode).plus("\n")
362362
codeGenerator
363363
.createNewFile(
364364
dependencies = Dependencies(true),
@@ -399,12 +399,12 @@ internal class Processor(
399399
${composable.name()}UIViewController${if (swiftExportEnabled) ".shared" else "()"}.make($makeParametersParsed)
400400
}
401401
402-
public func updateUIViewController(_ uiViewController: UIViewController, context _: Context) {
402+
public func updateUIViewController(_: UIViewController, context _: Context) {
403403
${composable.name()}UIViewController${if (swiftExportEnabled) ".shared" else "()"}.update($stateParameterName: $stateParameterName)
404404
}
405405
}
406406
""".trimIndent()
407-
val updatedCode = indentParameters(indentParameters(code, frameworks), letParameters)
407+
val updatedCode = indentParameters(indentParameters(code, frameworks), letParameters).plus("\n")
408408
codeGenerator
409409
.createNewFile(
410410
dependencies = Dependencies(true),

kmp-composeuiviewcontroller-ksp/src/test/kotlin/composeuiviewcontroller/Templates.kt

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -584,10 +584,11 @@ public struct ${functionName}Representable: UIViewControllerRepresentable {
584584
${functionName}UIViewController${if (isSharedInstance) ".shared" else "()"}.make(${params.joinToString(", ") { "${it.first}: ${it.first}" }})
585585
}
586586
587-
public func updateUIViewController(_ uiViewController: UIViewController, context _: Context) {
587+
public func updateUIViewController(_: UIViewController, context _: Context) {
588588
// unused
589589
}
590590
}
591+
591592
""".trimIndent()
592593

593594
fun swiftRepresentableWithState(
@@ -607,10 +608,11 @@ public struct ${functionName}Representable: UIViewControllerRepresentable {
607608
${functionName}UIViewController${if (isSharedInstance) ".shared" else "()"}.make()
608609
}
609610
610-
public func updateUIViewController(_ uiViewController: UIViewController, context _: Context) {
611+
public func updateUIViewController(_: UIViewController, context _: Context) {
611612
${functionName}UIViewController${if (isSharedInstance) ".shared" else "()"}.update(state: state)
612613
}
613614
}
615+
614616
""".trimIndent()
615617

616618
fun swiftRepresentableWithExternalDependency(framework: String = DEFAULT_FRAMEWORK, functionName: String = "Screen") = """
@@ -625,10 +627,11 @@ public struct ${functionName}Representable: UIViewControllerRepresentable {
625627
${functionName}UIViewController().make(data: data)
626628
}
627629
628-
public func updateUIViewController(_ uiViewController: UIViewController, context _: Context) {
630+
public func updateUIViewController(_: UIViewController, context _: Context) {
629631
// unused
630632
}
631633
}
634+
632635
""".trimIndent()
633636

634637
fun swiftRepresentableWithExternalDependencies(
@@ -648,10 +651,11 @@ public struct ${functionName}Representable: UIViewControllerRepresentable {
648651
${functionName}UIViewController.shared.make(data: data)
649652
}
650653
651-
public func updateUIViewController(_ uiViewController: UIViewController, context _: Context) {
654+
public func updateUIViewController(_: UIViewController, context _: Context) {
652655
// unused
653656
}
654657
}
658+
655659
""".trimIndent()
656660

657661
fun swiftRepresentableWithObjCTypes(
@@ -686,10 +690,11 @@ public struct ${functionName}Representable: UIViewControllerRepresentable {
686690
${functionName}UIViewController().make(callBackA: callBackA, callBackB: callBackB, callBackS: callBackS, callBackC: callBackC, callBackD: callBackD, callBackE: callBackE, callBackF: callBackF, callBackG: callBackG, callBackH: callBackH, callBackI: callBackI, callBackJ: callBackJ, callBackK: callBackK, callBackL: callBackL, callBackM: callBackM, callBackN: callBackN, callBackO: callBackO, callBackP: callBackP)
687691
}
688692
689-
public func updateUIViewController(_ uiViewController: UIViewController, context _: Context) {
693+
public func updateUIViewController(_: UIViewController, context _: Context) {
690694
${functionName}UIViewController().update(state: state)
691695
}
692696
}
697+
693698
""".trimIndent()
694699

695700
fun swiftRepresentableWithSwiftExportTypes(
@@ -724,10 +729,11 @@ public struct ${functionName}Representable: UIViewControllerRepresentable {
724729
${functionName}UIViewController.shared.make(callBackA: callBackA, callBackB: callBackB, callBackS: callBackS, callBackC: callBackC, callBackD: callBackD, callBackE: callBackE, callBackF: callBackF, callBackG: callBackG, callBackH: callBackH, callBackI: callBackI, callBackJ: callBackJ, callBackK: callBackK, callBackL: callBackL, callBackM: callBackM, callBackN: callBackN, callBackO: callBackO, callBackP: callBackP)
725730
}
726731
727-
public func updateUIViewController(_ uiViewController: UIViewController, context _: Context) {
732+
public func updateUIViewController(_: UIViewController, context _: Context) {
728733
${functionName}UIViewController.shared.update(state: state)
729734
}
730735
}
736+
731737
""".trimIndent()
732738

733739
fun swiftTypeAliasForExternalDependencies() = """
@@ -754,10 +760,11 @@ public struct ${functionName}Representable: UIViewControllerRepresentable {
754760
ScreenUIViewController().make()
755761
}
756762
757-
public func updateUIViewController(_ uiViewController: UIViewController, context _: Context) {
763+
public func updateUIViewController(_: UIViewController, context _: Context) {
758764
// unused
759765
}
760766
}
767+
761768
""".trimIndent()
762769
}
763770

0 commit comments

Comments
 (0)