Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/compilation-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ jobs:

steps:
- uses: actions/checkout@v1
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 11
java-version: 17
- name: Print Xcode version
run: xcodebuild -version
- name: Check build
run: ./gradlew build publishToMavenLocal syncMultiPlatformLibraryDebugFrameworkIosX64
- name: Install pods
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.gradle
.kotlin
.settings
.project
.classpath
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ allprojects {
project build.gradle
```groovy
dependencies {
commonMainApi("dev.icerock.moko:fields-core:0.12.0")
commonMainApi("dev.icerock.moko:fields-core:0.13.0")

// integration with reactive flows
commonMainApi("dev.icerock.moko:fields-livedata:0.12.0")
commonMainApi("dev.icerock.moko:fields-flow:0.12.0")
commonMainApi("dev.icerock.moko:fields-livedata:0.13.0")
commonMainApi("dev.icerock.moko:fields-flow:0.13.0")

androidMainApi("dev.icerock.moko:fields-material:0.12.0")
androidMainApi("dev.icerock.moko:fields-material:0.13.0")
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@

package dev.icerock.moko.fields.core

fun List<FormField<*, *>>.validate(): Boolean =
all { it.validate() }
fun List<FormField<*, *>>.validate(): Boolean {
return map { it.validate() }.all { it }
}
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
kotlinVersion = "1.8.10"
kotlinVersion = "1.9.10"

# android
androidAppCompatVersion = "1.6.1"
Expand All @@ -10,10 +10,10 @@ androidLifecycleVersion = "2.6.1"
coroutinesVersion = "1.6.4"

# moko
mokoResourcesVersion = "0.21.2"
mokoResourcesVersion = "0.24.5"
mokoMvvmVersion = "0.16.0"
mokoTestVersion = "0.6.1"
mokoFieldsVersion = "0.12.0"
mokoFieldsVersion = "0.13.0"

[libraries]
# android
Expand Down Expand Up @@ -41,7 +41,7 @@ mokoTest = { module = "dev.icerock.moko:test-core", version.ref = "mokoTestVersi

# gradle plugins
kotlinGradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlinVersion" }
androidGradlePlugin = { module = "com.android.tools.build:gradle", version = "7.4.2" }
androidGradlePlugin = { module = "com.android.tools.build:gradle", version = "8.2.1" }
mokoResourcesGradlePlugin = { module = "dev.icerock.moko:resources-generator", version.ref = "mokoResourcesVersion" }
mokoGradlePlugin = { module = "dev.icerock.moko:moko-gradle-plugin", version = "0.3.0" }
mokoGradlePlugin = { module = "dev.icerock.moko:moko-gradle-plugin", version = "0.4.2" }
mokoKSwiftGradlePlugin = { module = "dev.icerock.moko:kswift-gradle-plugin", version = "0.6.1" }
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Tue Apr 15 22:30:14 KRAT 2025
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
13 changes: 10 additions & 3 deletions sample-declarative-ui/androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ plugins {
}

android {
compileSdk = 33
compileSdk = 34
buildFeatures {
compose = true
}
defaultConfig {
applicationId = "dev.icerock.moko.fields.sample.declarativeui.android"
minSdk = 21
targetSdk = 33
targetSdk = 34
versionCode = 1
versionName = "1.0"
}
Expand All @@ -25,7 +25,14 @@ android {
}
}
composeOptions {
kotlinCompilerExtensionVersion = "1.4.4"
kotlinCompilerExtensionVersion = "1.5.15"
}

namespace = "dev.icerock.sample.declarativeui.android"

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}

Expand Down
6 changes: 2 additions & 4 deletions sample-declarative-ui/androidApp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="dev.icerock.moko.fields.sample.declarativeui.android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="false"
android:supportsRtl="true"
android:usesCleartextTraffic="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:name="dev.icerock.moko.fields.sample.declarativeui.android.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
15 changes: 11 additions & 4 deletions sample-declarative-ui/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ val dependenciesList = listOf(
)

kotlin {
android()
androidTarget()

val xcf = XCFramework("MultiPlatformLibrary")
listOf(
Expand Down Expand Up @@ -75,15 +75,22 @@ kotlin {
}

multiplatformResources {
multiplatformResourcesPackage = "dev.icerock.moko.fields.sample.declarativeui"
resourcesPackage.set("dev.icerock.moko.fields.sample.declarativeui.shared")
}

android {
compileSdk = 32
compileSdk = 34
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdk = 21
targetSdk = 32
targetSdk = 34
}

namespace = "dev.icerock.sample.declarativeui.shared"

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import dev.icerock.moko.fields.core.validations.notBlank
import dev.icerock.moko.fields.flow.FormField
import dev.icerock.moko.fields.flow.flowBlock
import dev.icerock.moko.fields.flow.validations.fieldValidation
import dev.icerock.moko.fields.sample.declarativeui.shared.MR
import dev.icerock.moko.mvvm.flow.CFlow
import dev.icerock.moko.mvvm.flow.cFlow
import dev.icerock.moko.mvvm.viewmodel.ViewModel
Expand Down
2 changes: 1 addition & 1 deletion sample/ios-app/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 407e24455d8967c472bda10cdbc0fe637bc20d05

COCOAPODS: 1.11.3
COCOAPODS: 1.16.2
36 changes: 18 additions & 18 deletions sample/ios-app/TestProj.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@
objects = {

/* Begin PBXBuildFile section */
2223D08027D24BA000DB5F95 /* dev_icerock_moko_mvvm-livedata.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2223D07F27D24BA000DB5F95 /* dev_icerock_moko_mvvm-livedata.swift */; };
2223D08227D24D7500DB5F95 /* dev_icerock_moko_mvvm-livedata-resources.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2223D08127D24D7500DB5F95 /* dev_icerock_moko_mvvm-livedata-resources.swift */; };
2B70A10DE02726CA8E6981EB /* Pods_TestProj.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E8D683A7C91DCD56058C7435 /* Pods_TestProj.framework */; };
45D74FCC22BFDDFD00CAB0C8 /* TestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45D74FCB22BFDDFD00CAB0C8 /* TestViewController.swift */; };
45F4791D219463C7003D25FA /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 45F47912219463C7003D25FA /* LaunchScreen.storyboard */; };
45F4791E219463C7003D25FA /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 45F47914219463C7003D25FA /* Main.storyboard */; };
45F47921219463C7003D25FA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 45F4791A219463C7003D25FA /* Assets.xcassets */; };
45F47922219463C7003D25FA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45F4791B219463C7003D25FA /* AppDelegate.swift */; };
DE7B200F2E0A96A400A41F56 /* dev_icerock_moko_mvvm-livedata.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE7B200C2E0A96A400A41F56 /* dev_icerock_moko_mvvm-livedata.swift */; };
DE7B20102E0A96A400A41F56 /* dev_icerock_moko_mvvm-livedata-resources.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE7B200D2E0A96A400A41F56 /* dev_icerock_moko_mvvm-livedata-resources.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
2223D07F27D24BA000DB5F95 /* dev_icerock_moko_mvvm-livedata.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "dev_icerock_moko_mvvm-livedata.swift"; path = "../mpp-library/build/cocoapods/framework/MultiPlatformLibrarySwift/dev_icerock_moko_mvvm-livedata.swift"; sourceTree = "<group>"; };
2223D08127D24D7500DB5F95 /* dev_icerock_moko_mvvm-livedata-resources.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "dev_icerock_moko_mvvm-livedata-resources.swift"; path = "../mpp-library/build/cocoapods/framework/MultiPlatformLibrarySwift/dev_icerock_moko_mvvm-livedata-resources.swift"; sourceTree = "<group>"; };
287627FF1F319065007FA12B /* mokoSampleFields.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = mokoSampleFields.app; sourceTree = BUILT_PRODUCTS_DIR; };
45964D362282A1FD00C16658 /* mpp-library */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "mpp-library"; path = "../mpp-library"; sourceTree = "<group>"; };
45D74FCB22BFDDFD00CAB0C8 /* TestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestViewController.swift; sourceTree = "<group>"; };
Expand All @@ -29,6 +27,8 @@
45F4791B219463C7003D25FA /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
45F4791C219463C7003D25FA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
A644D2F1C5377C40A53FCD6A /* Pods-TestProj.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TestProj.release.xcconfig"; path = "Pods/Target Support Files/Pods-TestProj/Pods-TestProj.release.xcconfig"; sourceTree = "<group>"; };
DE7B200C2E0A96A400A41F56 /* dev_icerock_moko_mvvm-livedata.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "dev_icerock_moko_mvvm-livedata.swift"; sourceTree = "<group>"; };
DE7B200D2E0A96A400A41F56 /* dev_icerock_moko_mvvm-livedata-resources.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "dev_icerock_moko_mvvm-livedata-resources.swift"; sourceTree = "<group>"; };
DFBDF7D3559D080FDCA444A6 /* Pods-TestProj.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TestProj.debug.xcconfig"; path = "Pods/Target Support Files/Pods-TestProj/Pods-TestProj.debug.xcconfig"; sourceTree = "<group>"; };
E8D683A7C91DCD56058C7435 /* Pods_TestProj.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_TestProj.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
Expand All @@ -54,20 +54,11 @@
name = Pods;
sourceTree = "<group>";
};
2223D07E27D24B8900DB5F95 /* kswift */ = {
isa = PBXGroup;
children = (
2223D08127D24D7500DB5F95 /* dev_icerock_moko_mvvm-livedata-resources.swift */,
2223D07F27D24BA000DB5F95 /* dev_icerock_moko_mvvm-livedata.swift */,
);
name = kswift;
sourceTree = "<group>";
};
287627F61F319065007FA12B = {
isa = PBXGroup;
children = (
DE7B200E2E0A96A400A41F56 /* kswift */,
45964D362282A1FD00C16658 /* mpp-library */,
2223D07E27D24B8900DB5F95 /* kswift */,
45F47910219463C7003D25FA /* src */,
287628001F319065007FA12B /* Products */,
EE1ABB3E79CE541540D3155F /* Frameworks */,
Expand Down Expand Up @@ -107,6 +98,15 @@
path = Resources;
sourceTree = "<group>";
};
DE7B200E2E0A96A400A41F56 /* kswift */ = {
isa = PBXGroup;
children = (
DE7B200C2E0A96A400A41F56 /* dev_icerock_moko_mvvm-livedata.swift */,
DE7B200D2E0A96A400A41F56 /* dev_icerock_moko_mvvm-livedata-resources.swift */,
);
path = kswift;
sourceTree = "<group>";
};
EE1ABB3E79CE541540D3155F /* Frameworks */ = {
isa = PBXGroup;
children = (
Expand All @@ -126,7 +126,7 @@
287627FB1F319065007FA12B /* Sources */,
287627FC1F319065007FA12B /* Frameworks */,
287627FD1F319065007FA12B /* Resources */,
1F30FEA104DFAFA202996FA6 /* [CP] Embed Pods Frameworks */,
A0E6ACB974C03BCECAC12349 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -187,7 +187,7 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
1F30FEA104DFAFA202996FA6 /* [CP] Embed Pods Frameworks */ = {
A0E6ACB974C03BCECAC12349 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand Down Expand Up @@ -231,10 +231,10 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
2223D08227D24D7500DB5F95 /* dev_icerock_moko_mvvm-livedata-resources.swift in Sources */,
45D74FCC22BFDDFD00CAB0C8 /* TestViewController.swift in Sources */,
DE7B200F2E0A96A400A41F56 /* dev_icerock_moko_mvvm-livedata.swift in Sources */,
DE7B20102E0A96A400A41F56 /* dev_icerock_moko_mvvm-livedata-resources.swift in Sources */,
45F47922219463C7003D25FA /* AppDelegate.swift in Sources */,
2223D08027D24BA000DB5F95 /* dev_icerock_moko_mvvm-livedata.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// This file automatically generated by MOKO KSwift (https://github.com/icerockdev/moko-kswift)
//
import MultiPlatformLibrary
import UIKit

public extension UIKit.UILabel {
/**
* selector: PackageFunctionContext/dev.icerock.moko:mvvm-livedata-resources/dev.icerock.moko.mvvm.livedata.resources/Class(name=platform/UIKit/UILabel)/bindText/liveData:Class(name=dev/icerock/moko/mvvm/livedata/LiveData)<TypeParameter(id=0)>
*/
@discardableResult
public func bindText<T : StringDesc>(liveData: LiveData<T>) -> Closeable {
return UILabelBindingKt.bindText(self, liveData: liveData as! MultiPlatformLibrary.LiveData<MultiPlatformLibrary.StringDesc>)
}
}
15 changes: 15 additions & 0 deletions sample/ios-app/kswift/dev_icerock_moko_mvvm-livedata.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// This file automatically generated by MOKO KSwift (https://github.com/icerockdev/moko-kswift)
//
import Foundation
import MultiPlatformLibrary
import UIKit

public extension UIKit.UITextField {
/**
* selector: PackageFunctionContext/dev.icerock.moko:mvvm-livedata/dev.icerock.moko.mvvm.livedata/Class(name=platform/UIKit/UITextField)/bindTextTwoWay/liveData:Class(name=dev/icerock/moko/mvvm/livedata/MutableLiveData)<Class(name=kotlin/String)>
*/
@discardableResult
public func bindTextTwoWay(liveData: MutableLiveData<NSString>) -> Closeable {
return UITextFieldBindingsKt.bindTextTwoWay(self, liveData: liveData)
}
}
15 changes: 15 additions & 0 deletions sample/mpp-library/MultiPlatformLibrarySwift.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Pod::Spec.new do |spec|
spec.name = 'MultiPlatformLibrarySwift'
spec.version = '1.0'
spec.homepage = 'Link to a Kotlin/Native module homepage'
spec.source = { :git => "Not Published", :tag => "Cocoapods/#{spec.name}/#{spec.version}" }
spec.authors = ''
spec.license = ''
spec.summary = 'Some description for a Kotlin/Native module'
spec.module_name = "MultiPlatformLibrarySwift"


spec.static_framework = false
spec.dependency 'MultiPlatformLibrary'
spec.source_files = "build/cocoapods/framework/MultiPlatformLibrarySwift/**/*.{h,m,swift}"
end
29 changes: 27 additions & 2 deletions sample/mpp-library/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import java.util.Locale

/*
* Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/
Expand Down Expand Up @@ -25,10 +29,12 @@ dependencies {
commonMainApi(libs.mokoMvvmLiveData)
commonMainApi(libs.mokoMvvmLiveDataResources)
commonMainApi(projects.fieldsLivedata)

iosMainImplementation("dev.icerock.moko:parcelize:0.9.0")
}

multiplatformResources {
multiplatformResourcesPackage = "com.icerockdev.library"
resourcesPackage.set("com.icerockdev.library")
}

framework {
Expand All @@ -40,5 +46,24 @@ framework {
}

kswift {
install(dev.icerock.moko.kswift.plugin.feature.PlatformExtensionFunctionsFeature)
projectPodspecName.set("MultiPlatformLibrary")

install(dev.icerock.moko.kswift.plugin.feature.PlatformExtensionFunctionsFeature) {
filter = includeFilter(
"PackageFunctionContext/dev.icerock.moko:mvvm-livedata/dev.icerock.moko.mvvm.livedata/Class(name=platform/UIKit/UITextField)/bindTextTwoWay/liveData:Class(name=dev/icerock/moko/mvvm/livedata/MutableLiveData)<Class(name=kotlin/String)>",
"PackageFunctionContext/dev.icerock.moko:mvvm-livedata-resources/dev.icerock.moko.mvvm.livedata.resources/Class(name=platform/UIKit/UILabel)/bindText/liveData:Class(name=dev/icerock/moko/mvvm/livedata/LiveData)<TypeParameter(id=0)>"
)
}
}

kotlin.targets.withType<KotlinNativeTarget>().configureEach {
binaries.withType<org.jetbrains.kotlin.gradle.plugin.mpp.Framework>().configureEach {
embedBitcodeMode.set(org.jetbrains.kotlin.gradle.plugin.mpp.BitcodeEmbeddingMode.DISABLE)
linkTask.doLast {
val file = File(outputDirectory, "${baseName}Swift")
val from = file.takeIf { it.exists() } ?: return@doLast
val to = File(rootDir, "sample/ios-app/kswift")
from.copyRecursively(to, overwrite = true)
}
}
}
1 change: 0 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*
* Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/
enableFeaturePreview("VERSION_CATALOGS")
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

dependencyResolutionManagement {
Expand Down
Loading