Skip to content

Commit

Permalink
🔀 Merge pull request #25 from vinceglb/migrate-viewmodel-library
Browse files Browse the repository at this point in the history
♻️ Migrate viewModel library
  • Loading branch information
vinceglb authored May 19, 2024
2 parents 11e7b06 + ff13a9b commit 06ba727
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 35 deletions.
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ android-compose = "1.9.0"
coilCompose = "3.0.0-alpha06"
compose-plugin = "1.6.10-rc01"
jna = "5.14.0"
kmmViewmodel = "1.0.0-ALPHA-20-kotlin-2.0.0-RC2"
observable-viewmodel = "1.0.0-BETA-1-kotlin-2.0.0-RC2"
koinCompose = "1.2.0-alpha3"
kotlin = "2.0.0-RC2"
kotlinx-coroutines = "1.8.1"
Expand All @@ -16,7 +16,7 @@ androidx-activity-compose = { module = "androidx.activity:activity-compose", ver
androidx-activity-ktx = { group = "androidx.activity", name = "activity-ktx", version.ref = "android-activity-ktx" }
coil-compose = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coilCompose" }
jna = { module = "net.java.dev.jna:jna", version.ref = "jna" }
kmm-viewmodel = { module = "com.rickclephas.kmm:kmm-viewmodel-core", version.ref = "kmmViewmodel" }
observable-viewmodel = { module = "com.rickclephas.kmp:kmp-observableviewmodel-core", version.ref = "observable-viewmodel" }
koin-compose = { module = "io.insert-koin:koin-compose", version.ref = "koinCompose" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-swing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
objects = {

/* Begin PBXBuildFile section */
BF104B0C2BED41390046917B /* KMMViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF104B0B2BED41390046917B /* KMMViewModel.swift */; };
BF104B0F2BED419D0046917B /* KMMViewModelSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = BF104B0E2BED419D0046917B /* KMMViewModelSwiftUI */; };
BF104B0C2BED41390046917B /* KMPObservableViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF104B0B2BED41390046917B /* KMPObservableViewModel.swift */; };
BF82DAD02BFA279E00832E4D /* KMPObservableViewModelSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = BF82DACF2BFA279E00832E4D /* KMPObservableViewModelSwiftUI */; };
BF82DAD22BFA27C200832E4D /* KMPObservableViewModelSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = BF82DAD12BFA27C200832E4D /* KMPObservableViewModelSwiftUI */; };
BF8748C82BBF4342003493D5 /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF8748C72BBF4342003493D5 /* iOSApp.swift */; };
BF8748CA2BBF4342003493D5 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF8748C92BBF4342003493D5 /* ContentView.swift */; };
BF8748CC2BBF4343003493D5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BF8748CB2BBF4343003493D5 /* Assets.xcassets */; };
Expand All @@ -21,12 +22,11 @@
BF8748F12BBF45B9003493D5 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF8748F02BBF45B9003493D5 /* ContentView.swift */; };
BF8748F32BBF45BA003493D5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BF8748F22BBF45BA003493D5 /* Assets.xcassets */; };
BF8748F62BBF45BA003493D5 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BF8748F52BBF45BA003493D5 /* Preview Assets.xcassets */; };
BFCCCB632BEE1D7C00749584 /* KMMViewModelSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = BFCCCB622BEE1D7C00749584 /* KMMViewModelSwiftUI */; };
BFCCCB652BEE1E5B00749584 /* KMMViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFCCCB642BEE1E5B00749584 /* KMMViewModel.swift */; };
BFCCCB652BEE1E5B00749584 /* KMPObservableViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFCCCB642BEE1E5B00749584 /* KMPObservableViewModel.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
BF104B0B2BED41390046917B /* KMMViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMMViewModel.swift; sourceTree = "<group>"; };
BF104B0B2BED41390046917B /* KMPObservableViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPObservableViewModel.swift; sourceTree = "<group>"; };
BF8748C52BBF4342003493D5 /* iOSApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iOSApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
BF8748C72BBF4342003493D5 /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = "<group>"; };
BF8748C92BBF4342003493D5 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
Expand All @@ -43,23 +43,23 @@
BF8748F02BBF45B9003493D5 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
BF8748F22BBF45BA003493D5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
BF8748F52BBF45BA003493D5 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
BFCCCB642BEE1E5B00749584 /* KMMViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMMViewModel.swift; sourceTree = "<group>"; };
BFCCCB642BEE1E5B00749584 /* KMPObservableViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KMPObservableViewModel.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
BF8748C22BBF4342003493D5 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
BFCCCB632BEE1D7C00749584 /* KMMViewModelSwiftUI in Frameworks */,
BF82DAD02BFA279E00832E4D /* KMPObservableViewModelSwiftUI in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
BF8748D52BBF44E4003493D5 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
BF104B0F2BED419D0046917B /* KMMViewModelSwiftUI in Frameworks */,
BF82DAD22BFA27C200832E4D /* KMPObservableViewModelSwiftUI in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -106,7 +106,7 @@
children = (
BF8748C72BBF4342003493D5 /* iOSApp.swift */,
BF8748C92BBF4342003493D5 /* ContentView.swift */,
BFCCCB642BEE1E5B00749584 /* KMMViewModel.swift */,
BFCCCB642BEE1E5B00749584 /* KMPObservableViewModel.swift */,
BF8748CB2BBF4343003493D5 /* Assets.xcassets */,
BF8748CD2BBF4343003493D5 /* Preview Content */,
);
Expand All @@ -126,7 +126,7 @@
children = (
BF8748DA2BBF44E4003493D5 /* macOSApp.swift */,
BF8748DC2BBF44E4003493D5 /* ContentView.swift */,
BF104B0B2BED41390046917B /* KMMViewModel.swift */,
BF104B0B2BED41390046917B /* KMPObservableViewModel.swift */,
BF8748DE2BBF44E6003493D5 /* Assets.xcassets */,
BF8748E32BBF44E6003493D5 /* macOSApp.entitlements */,
BF8748E02BBF44E6003493D5 /* Preview Content */,
Expand Down Expand Up @@ -179,7 +179,7 @@
);
name = iOSApp;
packageProductDependencies = (
BFCCCB622BEE1D7C00749584 /* KMMViewModelSwiftUI */,
BF82DACF2BFA279E00832E4D /* KMPObservableViewModelSwiftUI */,
);
productName = iOSApp;
productReference = BF8748C52BBF4342003493D5 /* iOSApp.app */;
Expand All @@ -200,7 +200,7 @@
);
name = macOSApp;
packageProductDependencies = (
BF104B0E2BED419D0046917B /* KMMViewModelSwiftUI */,
BF82DAD12BFA27C200832E4D /* KMPObservableViewModelSwiftUI */,
);
productName = macOSApp;
productReference = BF8748D82BBF44E4003493D5 /* macOSApp.app */;
Expand Down Expand Up @@ -256,6 +256,7 @@
mainGroup = BF8748A72BBF427F003493D5;
packageReferences = (
BF104B0A2BED40C40046917B /* XCRemoteSwiftPackageReference "KMM-ViewModel" */,
BF82DACC2BFA279E00832E4D /* XCRemoteSwiftPackageReference "KMP-ObservableViewModel" */,
);
productRefGroup = BF8748B12BBF427F003493D5 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -357,7 +358,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BFCCCB652BEE1E5B00749584 /* KMMViewModel.swift in Sources */,
BFCCCB652BEE1E5B00749584 /* KMPObservableViewModel.swift in Sources */,
BF8748CA2BBF4342003493D5 /* ContentView.swift in Sources */,
BF8748C82BBF4342003493D5 /* iOSApp.swift in Sources */,
);
Expand All @@ -367,7 +368,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BF104B0C2BED41390046917B /* KMMViewModel.swift in Sources */,
BF104B0C2BED41390046917B /* KMPObservableViewModel.swift in Sources */,
BF8748DD2BBF44E4003493D5 /* ContentView.swift in Sources */,
BF8748DB2BBF44E4003493D5 /* macOSApp.swift in Sources */,
);
Expand Down Expand Up @@ -740,18 +741,26 @@
version = "1.0.0-ALPHA-20";
};
};
BF82DACC2BFA279E00832E4D /* XCRemoteSwiftPackageReference "KMP-ObservableViewModel" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/rickclephas/KMP-ObservableViewModel.git";
requirement = {
branch = master;
kind = branch;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
BF104B0E2BED419D0046917B /* KMMViewModelSwiftUI */ = {
BF82DACF2BFA279E00832E4D /* KMPObservableViewModelSwiftUI */ = {
isa = XCSwiftPackageProductDependency;
package = BF104B0A2BED40C40046917B /* XCRemoteSwiftPackageReference "KMM-ViewModel" */;
productName = KMMViewModelSwiftUI;
package = BF82DACC2BFA279E00832E4D /* XCRemoteSwiftPackageReference "KMP-ObservableViewModel" */;
productName = KMPObservableViewModelSwiftUI;
};
BFCCCB622BEE1D7C00749584 /* KMMViewModelSwiftUI */ = {
BF82DAD12BFA27C200832E4D /* KMPObservableViewModelSwiftUI */ = {
isa = XCSwiftPackageProductDependency;
package = BF104B0A2BED40C40046917B /* XCRemoteSwiftPackageReference "KMM-ViewModel" */;
productName = KMMViewModelSwiftUI;
package = BF82DACC2BFA279E00832E4D /* XCRemoteSwiftPackageReference "KMP-ObservableViewModel" */;
productName = KMPObservableViewModelSwiftUI;
};
/* End XCSwiftPackageProductDependency section */
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "ad556088e5aec34cec10a7ca9ac4b521b542b15ac04d30f37ec7b0f6e795db36",
"originHash" : "3eff510532cbd886b428b7d14e1f4ed286820714fa9ef4fbe832fd481f0742d1",
"pins" : [
{
"identity" : "kmm-viewmodel",
Expand All @@ -9,6 +9,15 @@
"revision" : "677d657ed678fadf50efac37b5d177170d6873a8",
"version" : "1.0.0-ALPHA-20"
}
},
{
"identity" : "kmp-observableviewmodel",
"kind" : "remoteSourceControl",
"location" : "https://github.com/rickclephas/KMP-ObservableViewModel.git",
"state" : {
"branch" : "master",
"revision" : "c5077ecb894a8acc038fdba484dab71a1a0b8344"
}
}
],
"version" : 3
Expand Down
2 changes: 1 addition & 1 deletion samples/sample-core/appleApps/iOSApp/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import SwiftUI
import KMMViewModelSwiftUI
import KMPObservableViewModelSwiftUI
import SamplePickerKt

struct ContentView: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Vincent Guillebaud on 10/05/2024.
//

import KMMViewModelCore
import KMPObservableViewModelCore
import SamplePickerKt

extension Kmm_viewmodel_coreKMMViewModel: KMMViewModel { }
extension Kmp_observableviewmodel_coreViewModel: ViewModel { }
2 changes: 1 addition & 1 deletion samples/sample-core/appleApps/macOSApp/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//

import SwiftUI
import KMMViewModelSwiftUI
import KMPObservableViewModelSwiftUI
import SamplePickerKt

struct ContentView: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by Vincent Guillebaud on 09/05/2024.
//

import KMMViewModelCore
import KMPObservableViewModelCore
import SamplePickerKt

extension Kmm_viewmodel_coreKMMViewModel: KMMViewModel { }
extension Kmp_observableviewmodel_coreViewModel: ViewModel { }
4 changes: 2 additions & 2 deletions samples/sample-core/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ kotlin {
// Picker-core
api(projects.pickerCore)

// KMM ViewModel
api(libs.kmm.viewmodel)
// Observable ViewModel
api(libs.observable.viewmodel)
}

// https://github.com/rickclephas/kmm-viewmodel/?tab=readme-ov-file#kotlin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.github.vinceglb.sample.core

import com.rickclephas.kmm.viewmodel.KMMViewModel
import com.rickclephas.kmm.viewmodel.MutableStateFlow
import com.rickclephas.kmm.viewmodel.coroutineScope
import com.rickclephas.kmp.observableviewmodel.MutableStateFlow
import com.rickclephas.kmp.observableviewmodel.ViewModel
import com.rickclephas.kmp.observableviewmodel.coroutineScope
import io.github.vinceglb.picker.core.Picker
import io.github.vinceglb.picker.core.PickerSelectionMode
import io.github.vinceglb.picker.core.PickerSelectionType
Expand All @@ -15,7 +15,7 @@ import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.update
import kotlinx.coroutines.launch

class MainViewModel : KMMViewModel() {
class MainViewModel : ViewModel() {
private val _uiState = MutableStateFlow(viewModelScope, MainUiState())
val uiState: StateFlow<MainUiState> = _uiState

Expand Down

0 comments on commit 06ba727

Please sign in to comment.