Arkadii Ivanov
4 years ago
committed by
GitHub
68 changed files with 1410 additions and 236 deletions
@ -0,0 +1,26 @@ |
|||||||
|
import gradle.kotlin.dsl.accessors._2e8a70bdda5e56ec477a6ff432ddf9d7.android |
||||||
|
|
||||||
|
plugins { |
||||||
|
id("com.android.library") |
||||||
|
} |
||||||
|
|
||||||
|
android { |
||||||
|
compileSdkVersion(30) |
||||||
|
|
||||||
|
defaultConfig { |
||||||
|
minSdkVersion(23) |
||||||
|
targetSdkVersion(30) |
||||||
|
} |
||||||
|
|
||||||
|
compileOptions { |
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8 |
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8 |
||||||
|
} |
||||||
|
|
||||||
|
sourceSets { |
||||||
|
named("main") { |
||||||
|
manifest.srcFile("src/androidMain/AndroidManifest.xml") |
||||||
|
res.srcDirs("src/androidMain/res") |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -1,29 +1,39 @@ |
|||||||
import org.jetbrains.compose.compose |
import org.jetbrains.compose.compose |
||||||
|
|
||||||
plugins { |
plugins { |
||||||
|
id("com.android.library") |
||||||
id("kotlin-multiplatform") |
id("kotlin-multiplatform") |
||||||
id("org.jetbrains.compose") |
id("org.jetbrains.compose") |
||||||
} |
} |
||||||
|
|
||||||
kotlin { |
kotlin { |
||||||
|
jvm("desktop") |
||||||
|
android() |
||||||
|
|
||||||
sourceSets { |
sourceSets { |
||||||
named("commonMain") { |
named("commonMain") { |
||||||
dependencies { |
dependencies { |
||||||
api(compose.runtime) |
implementation(compose.runtime) |
||||||
api(compose.foundation) |
implementation(compose.foundation) |
||||||
api(compose.material) |
implementation(compose.material) |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
named("androidMain") { |
named("androidMain") { |
||||||
dependencies { |
dependencies { |
||||||
api("androidx.appcompat:appcompat:1.1.0") |
implementation("androidx.appcompat:appcompat:1.1.0") |
||||||
api("androidx.core:core-ktx:1.3.1") |
implementation("androidx.core:core-ktx:1.3.1") |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
named("desktopMain") { |
named("desktopMain") { |
||||||
dependencies { |
dependencies { |
||||||
api(compose.desktop.common) |
implementation(compose.desktop.common) |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { |
||||||
|
kotlinOptions.jvmTarget = "1.8" |
||||||
|
} |
||||||
} |
} |
||||||
|
@ -0,0 +1,18 @@ |
|||||||
|
plugins { |
||||||
|
id("multiplatform-compose-setup") |
||||||
|
id("android-setup") |
||||||
|
} |
||||||
|
|
||||||
|
kotlin { |
||||||
|
sourceSets { |
||||||
|
named("commonMain") { |
||||||
|
dependencies { |
||||||
|
implementation(project(":common:main")) |
||||||
|
implementation(project(":common:edit")) |
||||||
|
implementation(project(":common:root")) |
||||||
|
implementation(Deps.ArkIvanov.Decompose.decompose) |
||||||
|
implementation(Deps.ArkIvanov.Decompose.extensionsCompose) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,2 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<manifest package="example.todo.common.ui"/> |
@ -1,4 +1,4 @@ |
|||||||
package example.todo.common.utils.compose |
package example.todo.common.ui |
||||||
|
|
||||||
import androidx.compose.foundation.lazy.LazyListState |
import androidx.compose.foundation.lazy.LazyListState |
||||||
import androidx.compose.runtime.Composable |
import androidx.compose.runtime.Composable |
@ -0,0 +1,20 @@ |
|||||||
|
package example.todo.common.ui |
||||||
|
|
||||||
|
import androidx.compose.runtime.Composable |
||||||
|
|
||||||
|
fun <T, K> crossfade(): @Composable (currentChild: T, currentKey: K, children: @Composable (T, K) -> Unit) -> Unit = |
||||||
|
{ currentChild: T, currentKey: K, children: @Composable (T, K) -> Unit -> |
||||||
|
KeyedCrossfade(currentChild, currentKey, children) |
||||||
|
} |
||||||
|
|
||||||
|
@Composable |
||||||
|
private fun <T, K> KeyedCrossfade(currentChild: T, currentKey: K, children: @Composable (T, K) -> Unit) { |
||||||
|
androidx.compose.animation.Crossfade(current = ChildWrapper(currentChild, currentKey)) { |
||||||
|
children(it.child, it.key) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private class ChildWrapper<out T, out C>(val child: T, val key: C) { |
||||||
|
override fun equals(other: Any?): Boolean = key == (other as? ChildWrapper<*, *>)?.key |
||||||
|
override fun hashCode(): Int = key.hashCode() |
||||||
|
} |
@ -1,4 +1,4 @@ |
|||||||
package example.todo.common.utils.compose |
package example.todo.common.ui |
||||||
|
|
||||||
import androidx.compose.foundation.lazy.LazyListState |
import androidx.compose.foundation.lazy.LazyListState |
||||||
import androidx.compose.runtime.Composable |
import androidx.compose.runtime.Composable |
@ -1,4 +1,4 @@ |
|||||||
package example.todo.common.utils |
package example.todo.common.ui |
||||||
|
|
||||||
import androidx.compose.ui.input.key.Key |
import androidx.compose.ui.input.key.Key |
||||||
import androidx.compose.ui.input.key.KeyEvent |
import androidx.compose.ui.input.key.KeyEvent |
@ -0,0 +1,16 @@ |
|||||||
|
package example.todo.common.ui |
||||||
|
|
||||||
|
import androidx.compose.runtime.Composable |
||||||
|
import com.arkivanov.decompose.extensions.compose.jetbrains.Children |
||||||
|
import example.todo.common.root.TodoRoot |
||||||
|
import example.todo.common.root.TodoRoot.Child |
||||||
|
|
||||||
|
@Composable |
||||||
|
fun TodoRootContent(component: TodoRoot) { |
||||||
|
Children(routerState = component.routerState, animation = crossfade()) { child, _ -> |
||||||
|
when (child) { |
||||||
|
is Child.Main -> TodoMainContent(child.component) |
||||||
|
is Child.Edit -> TodoEditContent(child.component) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -1,4 +1,4 @@ |
|||||||
package example.todo.common.utils.compose |
package example.todo.common.ui |
||||||
|
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi |
import androidx.compose.foundation.ExperimentalFoundationApi |
||||||
import androidx.compose.foundation.lazy.LazyListState |
import androidx.compose.foundation.lazy.LazyListState |
@ -0,0 +1,26 @@ |
|||||||
|
package example.todo.common.database |
||||||
|
|
||||||
|
import co.touchlab.sqliter.DatabaseConfiguration |
||||||
|
import com.squareup.sqldelight.db.SqlDriver |
||||||
|
import com.squareup.sqldelight.drivers.native.NativeSqliteDriver |
||||||
|
import com.squareup.sqldelight.drivers.native.wrapConnection |
||||||
|
import example.todo.database.TodoDatabase |
||||||
|
|
||||||
|
@Suppress("FunctionName") // Factory function |
||||||
|
actual fun TestDatabaseDriver(): SqlDriver { |
||||||
|
val schema = TodoDatabase.Schema |
||||||
|
|
||||||
|
return NativeSqliteDriver( |
||||||
|
DatabaseConfiguration( |
||||||
|
name = ":memory:", |
||||||
|
version = schema.version, |
||||||
|
create = { wrapConnection(it, schema::create) }, |
||||||
|
upgrade = { connection, oldVersion, newVersion -> |
||||||
|
wrapConnection(connection) { |
||||||
|
schema.migrate(it, oldVersion, newVersion) |
||||||
|
} |
||||||
|
}, |
||||||
|
inMemory = true |
||||||
|
) |
||||||
|
) |
||||||
|
} |
@ -0,0 +1,9 @@ |
|||||||
|
package example.todo.common.database |
||||||
|
|
||||||
|
import com.squareup.sqldelight.db.SqlDriver |
||||||
|
import com.squareup.sqldelight.drivers.native.NativeSqliteDriver |
||||||
|
import example.todo.database.TodoDatabase |
||||||
|
|
||||||
|
@Suppress("FunctionName") // Factory function |
||||||
|
fun TodoDatabaseDriver(): SqlDriver = |
||||||
|
NativeSqliteDriver(TodoDatabase.Schema, "TodoDatabase.db") |
@ -1,6 +1,6 @@ |
|||||||
package example.todo.common.edit |
package example.todo.common.edit |
||||||
|
|
||||||
data class TodoItem( |
internal data class TodoItem( |
||||||
val text: String, |
val text: String, |
||||||
val isDone: Boolean |
val isDone: Boolean |
||||||
) |
) |
||||||
|
@ -0,0 +1,12 @@ |
|||||||
|
package example.todo.common.edit.integration |
||||||
|
|
||||||
|
import example.todo.common.edit.TodoEdit.Model |
||||||
|
import example.todo.common.edit.store.TodoEditStore.State |
||||||
|
|
||||||
|
internal val stateToModel: (State) -> Model = |
||||||
|
{ |
||||||
|
Model( |
||||||
|
text = it.text, |
||||||
|
isDone = it.isDone |
||||||
|
) |
||||||
|
} |
@ -1,6 +1,6 @@ |
|||||||
package example.todo.common.main.store |
package example.todo.common.main |
||||||
|
|
||||||
internal data class TodoItem( |
data class TodoItem( |
||||||
val id: Long = 0L, |
val id: Long = 0L, |
||||||
val order: Long = 0L, |
val order: Long = 0L, |
||||||
val text: String = "", |
val text: String = "", |
@ -0,0 +1,12 @@ |
|||||||
|
package example.todo.common.main.integration |
||||||
|
|
||||||
|
import example.todo.common.main.TodoMain.Model |
||||||
|
import example.todo.common.main.store.TodoMainStore.State |
||||||
|
|
||||||
|
internal val stateToModel: (State) -> Model = |
||||||
|
{ |
||||||
|
Model( |
||||||
|
items = it.items, |
||||||
|
text = it.text |
||||||
|
) |
||||||
|
} |
@ -1,24 +0,0 @@ |
|||||||
package example.todo.common.utils |
|
||||||
|
|
||||||
import com.arkivanov.decompose.ComponentContext |
|
||||||
import com.arkivanov.decompose.lifecycle.Lifecycle |
|
||||||
import com.arkivanov.decompose.lifecycle.subscribe |
|
||||||
import com.arkivanov.mvikotlin.core.binder.Binder |
|
||||||
import com.arkivanov.mvikotlin.core.binder.BinderLifecycleMode |
|
||||||
import com.arkivanov.mvikotlin.extensions.reaktive.BindingsBuilder |
|
||||||
import com.arkivanov.mvikotlin.extensions.reaktive.bind |
|
||||||
|
|
||||||
fun bind(lifecycle: Lifecycle, mode: BinderLifecycleMode, builder: BindingsBuilder.() -> Unit): Binder { |
|
||||||
val binder = bind(builder) |
|
||||||
|
|
||||||
when (mode) { |
|
||||||
BinderLifecycleMode.CREATE_DESTROY -> lifecycle.subscribe(onCreate = { binder.start() }, onDestroy = { binder.stop() }) |
|
||||||
BinderLifecycleMode.START_STOP -> lifecycle.subscribe(onStart = { binder.start() }, onStop = { binder.stop() }) |
|
||||||
BinderLifecycleMode.RESUME_PAUSE -> lifecycle.subscribe(onResume = { binder.start() }, onPause = { binder.stop() }) |
|
||||||
}.let {} |
|
||||||
|
|
||||||
return binder |
|
||||||
} |
|
||||||
|
|
||||||
fun ComponentContext.bind(mode: BinderLifecycleMode, builder: BindingsBuilder.() -> Unit): Binder = |
|
||||||
bind(lifecycle, mode, builder) |
|
@ -1,9 +0,0 @@ |
|||||||
package example.todo.common.utils |
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable |
|
||||||
|
|
||||||
interface Component { |
|
||||||
|
|
||||||
@Composable |
|
||||||
operator fun invoke() |
|
||||||
} |
|
@ -1,16 +0,0 @@ |
|||||||
package example.todo.common.utils |
|
||||||
|
|
||||||
import androidx.compose.animation.Crossfade |
|
||||||
import androidx.compose.runtime.Composable |
|
||||||
|
|
||||||
@Composable |
|
||||||
fun <T> Crossfade(currentChild: T, currentKey: Any, children: @Composable() (T) -> Unit) { |
|
||||||
Crossfade(current = ChildWrapper(currentChild, currentKey)) { |
|
||||||
children(it.child) |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private class ChildWrapper<out T>(val child: T, val key: Any) { |
|
||||||
override fun equals(other: Any?): Boolean = key == (other as? ChildWrapper<*>)?.key |
|
||||||
override fun hashCode(): Int = key.hashCode() |
|
||||||
} |
|
@ -1,20 +1,23 @@ |
|||||||
package example.todo.common.utils |
package example.todo.common.utils |
||||||
|
|
||||||
import androidx.compose.runtime.Composable |
import com.arkivanov.decompose.value.Value |
||||||
import androidx.compose.runtime.State |
import com.arkivanov.decompose.value.ValueObserver |
||||||
import androidx.compose.runtime.mutableStateOf |
|
||||||
import androidx.compose.runtime.onDispose |
|
||||||
import androidx.compose.runtime.remember |
|
||||||
import com.arkivanov.mvikotlin.core.store.Store |
import com.arkivanov.mvikotlin.core.store.Store |
||||||
import com.arkivanov.mvikotlin.extensions.reaktive.states |
import com.arkivanov.mvikotlin.rx.Disposable |
||||||
import com.badoo.reaktive.observable.subscribe |
|
||||||
|
|
||||||
@Composable |
fun <T : Any> Store<*, T, *>.asValue(): Value<T> = |
||||||
val <T : Any> Store<*, T, *>.composeState: State<T> |
object : Value<T>() { |
||||||
get() { |
override val value: T get() = state |
||||||
val composeState = remember(this) { mutableStateOf(state) } |
private var disposables = emptyMap<ValueObserver<T>, Disposable>() |
||||||
val disposable = remember(this) { states.subscribe(onNext = { composeState.value = it }) } |
|
||||||
onDispose(disposable::dispose) |
|
||||||
|
|
||||||
return composeState |
override fun subscribe(observer: ValueObserver<T>) { |
||||||
|
val disposable = states(com.arkivanov.mvikotlin.rx.observer(onNext = observer)) |
||||||
|
this.disposables += observer to disposable |
||||||
|
} |
||||||
|
|
||||||
|
override fun unsubscribe(observer: ValueObserver<T>) { |
||||||
|
val disposable = disposables[observer] ?: return |
||||||
|
this.disposables -= observer |
||||||
|
disposable.dispose() |
||||||
|
} |
||||||
} |
} |
||||||
|
@ -0,0 +1,18 @@ |
|||||||
|
DerivedData/ |
||||||
|
*.pbxuser |
||||||
|
!default.pbxuser |
||||||
|
*.mode1v3 |
||||||
|
!default.mode1v3 |
||||||
|
*.mode2v3 |
||||||
|
!default.mode2v3 |
||||||
|
*.perspectivev3 |
||||||
|
!default.perspectivev3 |
||||||
|
xcuserdata/ |
||||||
|
*.moved-aside |
||||||
|
*.xccheckout |
||||||
|
*.xcscmblueprint |
||||||
|
*.hmap |
||||||
|
*.ipa |
||||||
|
*.dSYM.zip |
||||||
|
*.dSYM |
||||||
|
Pods |
@ -0,0 +1,418 @@ |
|||||||
|
// !$*UTF8*$! |
||||||
|
{ |
||||||
|
archiveVersion = 1; |
||||||
|
classes = { |
||||||
|
}; |
||||||
|
objectVersion = 50; |
||||||
|
objects = { |
||||||
|
|
||||||
|
/* Begin PBXBuildFile section */ |
||||||
|
1F00F38D257599D800CFAF97 /* TodoApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F00F38C257599D800CFAF97 /* TodoApp.swift */; }; |
||||||
|
1F00F38F257599D800CFAF97 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F00F38E257599D800CFAF97 /* ContentView.swift */; }; |
||||||
|
1F00F391257599DA00CFAF97 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1F00F390257599DA00CFAF97 /* Assets.xcassets */; }; |
||||||
|
1F00F394257599DA00CFAF97 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 1F00F393257599DA00CFAF97 /* Preview Assets.xcassets */; }; |
||||||
|
1F00F3A425759FEC00CFAF97 /* Todo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1F00F3A325759FEC00CFAF97 /* Todo.framework */; }; |
||||||
|
1F00F3A525759FEC00CFAF97 /* Todo.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 1F00F3A325759FEC00CFAF97 /* Todo.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; |
||||||
|
1F00F3A82575A16400CFAF97 /* ObservableValue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F00F3A72575A16400CFAF97 /* ObservableValue.swift */; }; |
||||||
|
1F00F3AA2575A71000CFAF97 /* MutableStateBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F00F3A92575A71000CFAF97 /* MutableStateBuilder.swift */; }; |
||||||
|
1F00F3AC2575AA4500CFAF97 /* ListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F00F3AB2575AA4500CFAF97 /* ListView.swift */; }; |
||||||
|
1F00F3AE2575AC6A00CFAF97 /* InputView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F00F3AD2575AC6A00CFAF97 /* InputView.swift */; }; |
||||||
|
1F00F3B02575ADB500CFAF97 /* MainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F00F3AF2575ADB500CFAF97 /* MainView.swift */; }; |
||||||
|
1F00F3B22575B07700CFAF97 /* EditView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F00F3B12575B07700CFAF97 /* EditView.swift */; }; |
||||||
|
1F00F3B42575B18200CFAF97 /* RootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F00F3B32575B18200CFAF97 /* RootView.swift */; }; |
||||||
|
1F00F3B62575B41900CFAF97 /* SimpleRouterState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F00F3B52575B41900CFAF97 /* SimpleRouterState.swift */; }; |
||||||
|
1F00F3B82575B4F800CFAF97 /* ComponentHolder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1F00F3B72575B4F800CFAF97 /* ComponentHolder.swift */; }; |
||||||
|
/* End PBXBuildFile section */ |
||||||
|
|
||||||
|
/* Begin PBXCopyFilesBuildPhase section */ |
||||||
|
1F00F3A625759FEC00CFAF97 /* Embed Frameworks */ = { |
||||||
|
isa = PBXCopyFilesBuildPhase; |
||||||
|
buildActionMask = 2147483647; |
||||||
|
dstPath = ""; |
||||||
|
dstSubfolderSpec = 10; |
||||||
|
files = ( |
||||||
|
1F00F3A525759FEC00CFAF97 /* Todo.framework in Embed Frameworks */, |
||||||
|
); |
||||||
|
name = "Embed Frameworks"; |
||||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||||
|
}; |
||||||
|
/* End PBXCopyFilesBuildPhase section */ |
||||||
|
|
||||||
|
/* Begin PBXFileReference section */ |
||||||
|
1F00F389257599D800CFAF97 /* TodoApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TodoApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; |
||||||
|
1F00F38C257599D800CFAF97 /* TodoApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodoApp.swift; sourceTree = "<group>"; }; |
||||||
|
1F00F38E257599D800CFAF97 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; }; |
||||||
|
1F00F390257599DA00CFAF97 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; |
||||||
|
1F00F393257599DA00CFAF97 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; }; |
||||||
|
1F00F395257599DA00CFAF97 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; |
||||||
|
1F00F3A325759FEC00CFAF97 /* Todo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Todo.framework; path = "../common/root/build/xcode-frameworks/Todo.framework"; sourceTree = "<group>"; }; |
||||||
|
1F00F3A72575A16400CFAF97 /* ObservableValue.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObservableValue.swift; sourceTree = "<group>"; }; |
||||||
|
1F00F3A92575A71000CFAF97 /* MutableStateBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MutableStateBuilder.swift; sourceTree = "<group>"; }; |
||||||
|
1F00F3AB2575AA4500CFAF97 /* ListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListView.swift; sourceTree = "<group>"; }; |
||||||
|
1F00F3AD2575AC6A00CFAF97 /* InputView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputView.swift; sourceTree = "<group>"; }; |
||||||
|
1F00F3AF2575ADB500CFAF97 /* MainView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainView.swift; sourceTree = "<group>"; }; |
||||||
|
1F00F3B12575B07700CFAF97 /* EditView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditView.swift; sourceTree = "<group>"; }; |
||||||
|
1F00F3B32575B18200CFAF97 /* RootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootView.swift; sourceTree = "<group>"; }; |
||||||
|
1F00F3B52575B41900CFAF97 /* SimpleRouterState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimpleRouterState.swift; sourceTree = "<group>"; }; |
||||||
|
1F00F3B72575B4F800CFAF97 /* ComponentHolder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ComponentHolder.swift; sourceTree = "<group>"; }; |
||||||
|
/* End PBXFileReference section */ |
||||||
|
|
||||||
|
/* Begin PBXFrameworksBuildPhase section */ |
||||||
|
1F00F386257599D800CFAF97 /* Frameworks */ = { |
||||||
|
isa = PBXFrameworksBuildPhase; |
||||||
|
buildActionMask = 2147483647; |
||||||
|
files = ( |
||||||
|
1F00F3A425759FEC00CFAF97 /* Todo.framework in Frameworks */, |
||||||
|
); |
||||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||||
|
}; |
||||||
|
/* End PBXFrameworksBuildPhase section */ |
||||||
|
|
||||||
|
/* Begin PBXGroup section */ |
||||||
|
1F00F380257599D800CFAF97 = { |
||||||
|
isa = PBXGroup; |
||||||
|
children = ( |
||||||
|
1F00F38B257599D800CFAF97 /* ios */, |
||||||
|
1F00F38A257599D800CFAF97 /* Products */, |
||||||
|
1F00F3A225759FEC00CFAF97 /* Frameworks */, |
||||||
|
); |
||||||
|
sourceTree = "<group>"; |
||||||
|
}; |
||||||
|
1F00F38A257599D800CFAF97 /* Products */ = { |
||||||
|
isa = PBXGroup; |
||||||
|
children = ( |
||||||
|
1F00F389257599D800CFAF97 /* TodoApp.app */, |
||||||
|
); |
||||||
|
name = Products; |
||||||
|
sourceTree = "<group>"; |
||||||
|
}; |
||||||
|
1F00F38B257599D800CFAF97 /* ios */ = { |
||||||
|
isa = PBXGroup; |
||||||
|
children = ( |
||||||
|
1F00F38C257599D800CFAF97 /* TodoApp.swift */, |
||||||
|
1F00F38E257599D800CFAF97 /* ContentView.swift */, |
||||||
|
1F00F390257599DA00CFAF97 /* Assets.xcassets */, |
||||||
|
1F00F395257599DA00CFAF97 /* Info.plist */, |
||||||
|
1F00F392257599DA00CFAF97 /* Preview Content */, |
||||||
|
1F00F3A72575A16400CFAF97 /* ObservableValue.swift */, |
||||||
|
1F00F3A92575A71000CFAF97 /* MutableStateBuilder.swift */, |
||||||
|
1F00F3AB2575AA4500CFAF97 /* ListView.swift */, |
||||||
|
1F00F3AD2575AC6A00CFAF97 /* InputView.swift */, |
||||||
|
1F00F3AF2575ADB500CFAF97 /* MainView.swift */, |
||||||
|
1F00F3B12575B07700CFAF97 /* EditView.swift */, |
||||||
|
1F00F3B32575B18200CFAF97 /* RootView.swift */, |
||||||
|
1F00F3B52575B41900CFAF97 /* SimpleRouterState.swift */, |
||||||
|
1F00F3B72575B4F800CFAF97 /* ComponentHolder.swift */, |
||||||
|
); |
||||||
|
path = ios; |
||||||
|
sourceTree = "<group>"; |
||||||
|
}; |
||||||
|
1F00F392257599DA00CFAF97 /* Preview Content */ = { |
||||||
|
isa = PBXGroup; |
||||||
|
children = ( |
||||||
|
1F00F393257599DA00CFAF97 /* Preview Assets.xcassets */, |
||||||
|
); |
||||||
|
path = "Preview Content"; |
||||||
|
sourceTree = "<group>"; |
||||||
|
}; |
||||||
|
1F00F3A225759FEC00CFAF97 /* Frameworks */ = { |
||||||
|
isa = PBXGroup; |
||||||
|
children = ( |
||||||
|
1F00F3A325759FEC00CFAF97 /* Todo.framework */, |
||||||
|
); |
||||||
|
name = Frameworks; |
||||||
|
sourceTree = "<group>"; |
||||||
|
}; |
||||||
|
/* End PBXGroup section */ |
||||||
|
|
||||||
|
/* Begin PBXNativeTarget section */ |
||||||
|
1F00F388257599D800CFAF97 /* TodoApp */ = { |
||||||
|
isa = PBXNativeTarget; |
||||||
|
buildConfigurationList = 1F00F398257599DA00CFAF97 /* Build configuration list for PBXNativeTarget "TodoApp" */; |
||||||
|
buildPhases = ( |
||||||
|
1F00F39D25759BB300CFAF97 /* ShellScript */, |
||||||
|
1F00F385257599D800CFAF97 /* Sources */, |
||||||
|
1F00F386257599D800CFAF97 /* Frameworks */, |
||||||
|
1F00F387257599D800CFAF97 /* Resources */, |
||||||
|
1F00F3A625759FEC00CFAF97 /* Embed Frameworks */, |
||||||
|
); |
||||||
|
buildRules = ( |
||||||
|
); |
||||||
|
dependencies = ( |
||||||
|
); |
||||||
|
name = TodoApp; |
||||||
|
productName = ios; |
||||||
|
productReference = 1F00F389257599D800CFAF97 /* TodoApp.app */; |
||||||
|
productType = "com.apple.product-type.application"; |
||||||
|
}; |
||||||
|
/* End PBXNativeTarget section */ |
||||||
|
|
||||||
|
/* Begin PBXProject section */ |
||||||
|
1F00F381257599D800CFAF97 /* Project object */ = { |
||||||
|
isa = PBXProject; |
||||||
|
attributes = { |
||||||
|
LastSwiftUpdateCheck = 1220; |
||||||
|
LastUpgradeCheck = 1220; |
||||||
|
TargetAttributes = { |
||||||
|
1F00F388257599D800CFAF97 = { |
||||||
|
CreatedOnToolsVersion = 12.2; |
||||||
|
}; |
||||||
|
}; |
||||||
|
}; |
||||||
|
buildConfigurationList = 1F00F384257599D800CFAF97 /* Build configuration list for PBXProject "TodoApp" */; |
||||||
|
compatibilityVersion = "Xcode 9.3"; |
||||||
|
developmentRegion = en; |
||||||
|
hasScannedForEncodings = 0; |
||||||
|
knownRegions = ( |
||||||
|
en, |
||||||
|
Base, |
||||||
|
); |
||||||
|
mainGroup = 1F00F380257599D800CFAF97; |
||||||
|
productRefGroup = 1F00F38A257599D800CFAF97 /* Products */; |
||||||
|
projectDirPath = ""; |
||||||
|
projectRoot = ""; |
||||||
|
targets = ( |
||||||
|
1F00F388257599D800CFAF97 /* TodoApp */, |
||||||
|
); |
||||||
|
}; |
||||||
|
/* End PBXProject section */ |
||||||
|
|
||||||
|
/* Begin PBXResourcesBuildPhase section */ |
||||||
|
1F00F387257599D800CFAF97 /* Resources */ = { |
||||||
|
isa = PBXResourcesBuildPhase; |
||||||
|
buildActionMask = 2147483647; |
||||||
|
files = ( |
||||||
|
1F00F394257599DA00CFAF97 /* Preview Assets.xcassets in Resources */, |
||||||
|
1F00F391257599DA00CFAF97 /* Assets.xcassets in Resources */, |
||||||
|
); |
||||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||||
|
}; |
||||||
|
/* End PBXResourcesBuildPhase section */ |
||||||
|
|
||||||
|
/* Begin PBXShellScriptBuildPhase section */ |
||||||
|
1F00F39D25759BB300CFAF97 /* ShellScript */ = { |
||||||
|
isa = PBXShellScriptBuildPhase; |
||||||
|
buildActionMask = 2147483647; |
||||||
|
files = ( |
||||||
|
); |
||||||
|
inputFileListPaths = ( |
||||||
|
); |
||||||
|
inputPaths = ( |
||||||
|
); |
||||||
|
outputFileListPaths = ( |
||||||
|
); |
||||||
|
outputPaths = ( |
||||||
|
); |
||||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||||
|
shellPath = /bin/sh; |
||||||
|
shellScript = "cd $SRCROOT/..\n./gradlew :common:root:packForXCode -PXCODE_CONFIGURATION=${CONFIGURATION}\ncd $SRCROOT\n"; |
||||||
|
}; |
||||||
|
/* End PBXShellScriptBuildPhase section */ |
||||||
|
|
||||||
|
/* Begin PBXSourcesBuildPhase section */ |
||||||
|
1F00F385257599D800CFAF97 /* Sources */ = { |
||||||
|
isa = PBXSourcesBuildPhase; |
||||||
|
buildActionMask = 2147483647; |
||||||
|
files = ( |
||||||
|
1F00F38F257599D800CFAF97 /* ContentView.swift in Sources */, |
||||||
|
1F00F3B02575ADB500CFAF97 /* MainView.swift in Sources */, |
||||||
|
1F00F3B22575B07700CFAF97 /* EditView.swift in Sources */, |
||||||
|
1F00F38D257599D800CFAF97 /* TodoApp.swift in Sources */, |
||||||
|
1F00F3AC2575AA4500CFAF97 /* ListView.swift in Sources */, |
||||||
|
1F00F3B82575B4F800CFAF97 /* ComponentHolder.swift in Sources */, |
||||||
|
1F00F3B42575B18200CFAF97 /* RootView.swift in Sources */, |
||||||
|
1F00F3B62575B41900CFAF97 /* SimpleRouterState.swift in Sources */, |
||||||
|
1F00F3AE2575AC6A00CFAF97 /* InputView.swift in Sources */, |
||||||
|
1F00F3AA2575A71000CFAF97 /* MutableStateBuilder.swift in Sources */, |
||||||
|
1F00F3A82575A16400CFAF97 /* ObservableValue.swift in Sources */, |
||||||
|
); |
||||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||||
|
}; |
||||||
|
/* End PBXSourcesBuildPhase section */ |
||||||
|
|
||||||
|
/* Begin XCBuildConfiguration section */ |
||||||
|
1F00F396257599DA00CFAF97 /* Debug */ = { |
||||||
|
isa = XCBuildConfiguration; |
||||||
|
buildSettings = { |
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO; |
||||||
|
CLANG_ANALYZER_NONNULL = YES; |
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; |
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; |
||||||
|
CLANG_CXX_LIBRARY = "libc++"; |
||||||
|
CLANG_ENABLE_MODULES = YES; |
||||||
|
CLANG_ENABLE_OBJC_ARC = YES; |
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES; |
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; |
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES; |
||||||
|
CLANG_WARN_COMMA = YES; |
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES; |
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; |
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; |
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES; |
||||||
|
CLANG_WARN_EMPTY_BODY = YES; |
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES; |
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES; |
||||||
|
CLANG_WARN_INT_CONVERSION = YES; |
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; |
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; |
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; |
||||||
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; |
||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; |
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; |
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES; |
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES; |
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; |
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES; |
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; |
||||||
|
COPY_PHASE_STRIP = NO; |
||||||
|
DEBUG_INFORMATION_FORMAT = dwarf; |
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES; |
||||||
|
ENABLE_TESTABILITY = YES; |
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu11; |
||||||
|
GCC_DYNAMIC_NO_PIC = NO; |
||||||
|
GCC_NO_COMMON_BLOCKS = YES; |
||||||
|
GCC_OPTIMIZATION_LEVEL = 0; |
||||||
|
GCC_PREPROCESSOR_DEFINITIONS = ( |
||||||
|
"DEBUG=1", |
||||||
|
"$(inherited)", |
||||||
|
); |
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; |
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; |
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES; |
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; |
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES; |
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES; |
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 14.2; |
||||||
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; |
||||||
|
MTL_FAST_MATH = YES; |
||||||
|
ONLY_ACTIVE_ARCH = YES; |
||||||
|
SDKROOT = iphoneos; |
||||||
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; |
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; |
||||||
|
}; |
||||||
|
name = Debug; |
||||||
|
}; |
||||||
|
1F00F397257599DA00CFAF97 /* Release */ = { |
||||||
|
isa = XCBuildConfiguration; |
||||||
|
buildSettings = { |
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO; |
||||||
|
CLANG_ANALYZER_NONNULL = YES; |
||||||
|
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; |
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; |
||||||
|
CLANG_CXX_LIBRARY = "libc++"; |
||||||
|
CLANG_ENABLE_MODULES = YES; |
||||||
|
CLANG_ENABLE_OBJC_ARC = YES; |
||||||
|
CLANG_ENABLE_OBJC_WEAK = YES; |
||||||
|
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; |
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES; |
||||||
|
CLANG_WARN_COMMA = YES; |
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES; |
||||||
|
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; |
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; |
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES; |
||||||
|
CLANG_WARN_EMPTY_BODY = YES; |
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES; |
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES; |
||||||
|
CLANG_WARN_INT_CONVERSION = YES; |
||||||
|
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; |
||||||
|
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; |
||||||
|
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; |
||||||
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; |
||||||
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; |
||||||
|
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; |
||||||
|
CLANG_WARN_STRICT_PROTOTYPES = YES; |
||||||
|
CLANG_WARN_SUSPICIOUS_MOVE = YES; |
||||||
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; |
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES; |
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; |
||||||
|
COPY_PHASE_STRIP = NO; |
||||||
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; |
||||||
|
ENABLE_NS_ASSERTIONS = NO; |
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES; |
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu11; |
||||||
|
GCC_NO_COMMON_BLOCKS = YES; |
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES; |
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; |
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES; |
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; |
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES; |
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES; |
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 14.2; |
||||||
|
MTL_ENABLE_DEBUG_INFO = NO; |
||||||
|
MTL_FAST_MATH = YES; |
||||||
|
SDKROOT = iphoneos; |
||||||
|
SWIFT_COMPILATION_MODE = wholemodule; |
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-O"; |
||||||
|
VALIDATE_PRODUCT = YES; |
||||||
|
}; |
||||||
|
name = Release; |
||||||
|
}; |
||||||
|
1F00F399257599DA00CFAF97 /* Debug */ = { |
||||||
|
isa = XCBuildConfiguration; |
||||||
|
buildSettings = { |
||||||
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
||||||
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; |
||||||
|
CODE_SIGN_STYLE = Automatic; |
||||||
|
DEVELOPMENT_ASSET_PATHS = "\"ios/Preview Content\""; |
||||||
|
ENABLE_PREVIEWS = YES; |
||||||
|
FRAMEWORK_SEARCH_PATHS = "$SRCROOT/../common/root/build/xcode-frameworks"; |
||||||
|
INFOPLIST_FILE = ios/Info.plist; |
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 14.0; |
||||||
|
LD_RUNPATH_SEARCH_PATHS = ( |
||||||
|
"$(inherited)", |
||||||
|
"@executable_path/Frameworks", |
||||||
|
); |
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = org.jetbrains.todoapp; |
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)"; |
||||||
|
SWIFT_VERSION = 5.0; |
||||||
|
TARGETED_DEVICE_FAMILY = "1,2"; |
||||||
|
}; |
||||||
|
name = Debug; |
||||||
|
}; |
||||||
|
1F00F39A257599DA00CFAF97 /* Release */ = { |
||||||
|
isa = XCBuildConfiguration; |
||||||
|
buildSettings = { |
||||||
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
||||||
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; |
||||||
|
CODE_SIGN_STYLE = Automatic; |
||||||
|
DEVELOPMENT_ASSET_PATHS = "\"ios/Preview Content\""; |
||||||
|
ENABLE_PREVIEWS = YES; |
||||||
|
FRAMEWORK_SEARCH_PATHS = "$SRCROOT/../common/root/build/xcode-frameworks"; |
||||||
|
INFOPLIST_FILE = ios/Info.plist; |
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 14.0; |
||||||
|
LD_RUNPATH_SEARCH_PATHS = ( |
||||||
|
"$(inherited)", |
||||||
|
"@executable_path/Frameworks", |
||||||
|
); |
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = org.jetbrains.todoapp; |
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)"; |
||||||
|
SWIFT_VERSION = 5.0; |
||||||
|
TARGETED_DEVICE_FAMILY = "1,2"; |
||||||
|
}; |
||||||
|
name = Release; |
||||||
|
}; |
||||||
|
/* End XCBuildConfiguration section */ |
||||||
|
|
||||||
|
/* Begin XCConfigurationList section */ |
||||||
|
1F00F384257599D800CFAF97 /* Build configuration list for PBXProject "TodoApp" */ = { |
||||||
|
isa = XCConfigurationList; |
||||||
|
buildConfigurations = ( |
||||||
|
1F00F396257599DA00CFAF97 /* Debug */, |
||||||
|
1F00F397257599DA00CFAF97 /* Release */, |
||||||
|
); |
||||||
|
defaultConfigurationIsVisible = 0; |
||||||
|
defaultConfigurationName = Release; |
||||||
|
}; |
||||||
|
1F00F398257599DA00CFAF97 /* Build configuration list for PBXNativeTarget "TodoApp" */ = { |
||||||
|
isa = XCConfigurationList; |
||||||
|
buildConfigurations = ( |
||||||
|
1F00F399257599DA00CFAF97 /* Debug */, |
||||||
|
1F00F39A257599DA00CFAF97 /* Release */, |
||||||
|
); |
||||||
|
defaultConfigurationIsVisible = 0; |
||||||
|
defaultConfigurationName = Release; |
||||||
|
}; |
||||||
|
/* End XCConfigurationList section */ |
||||||
|
}; |
||||||
|
rootObject = 1F00F381257599D800CFAF97 /* Project object */; |
||||||
|
} |
@ -0,0 +1,7 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<Workspace |
||||||
|
version = "1.0"> |
||||||
|
<FileRef |
||||||
|
location = "self:/Users/arkadiiivanov/dev/compose-jb/examples/todoapp/ios/TodoApp.xcodeproj"> |
||||||
|
</FileRef> |
||||||
|
</Workspace> |
@ -0,0 +1,8 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
||||||
|
<plist version="1.0"> |
||||||
|
<dict> |
||||||
|
<key>IDEDidComputeMac32BitWarning</key> |
||||||
|
<true/> |
||||||
|
</dict> |
||||||
|
</plist> |
@ -0,0 +1,11 @@ |
|||||||
|
{ |
||||||
|
"colors" : [ |
||||||
|
{ |
||||||
|
"idiom" : "universal" |
||||||
|
} |
||||||
|
], |
||||||
|
"info" : { |
||||||
|
"author" : "xcode", |
||||||
|
"version" : 1 |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,98 @@ |
|||||||
|
{ |
||||||
|
"images" : [ |
||||||
|
{ |
||||||
|
"idiom" : "iphone", |
||||||
|
"scale" : "2x", |
||||||
|
"size" : "20x20" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "iphone", |
||||||
|
"scale" : "3x", |
||||||
|
"size" : "20x20" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "iphone", |
||||||
|
"scale" : "2x", |
||||||
|
"size" : "29x29" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "iphone", |
||||||
|
"scale" : "3x", |
||||||
|
"size" : "29x29" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "iphone", |
||||||
|
"scale" : "2x", |
||||||
|
"size" : "40x40" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "iphone", |
||||||
|
"scale" : "3x", |
||||||
|
"size" : "40x40" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "iphone", |
||||||
|
"scale" : "2x", |
||||||
|
"size" : "60x60" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "iphone", |
||||||
|
"scale" : "3x", |
||||||
|
"size" : "60x60" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "ipad", |
||||||
|
"scale" : "1x", |
||||||
|
"size" : "20x20" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "ipad", |
||||||
|
"scale" : "2x", |
||||||
|
"size" : "20x20" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "ipad", |
||||||
|
"scale" : "1x", |
||||||
|
"size" : "29x29" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "ipad", |
||||||
|
"scale" : "2x", |
||||||
|
"size" : "29x29" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "ipad", |
||||||
|
"scale" : "1x", |
||||||
|
"size" : "40x40" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "ipad", |
||||||
|
"scale" : "2x", |
||||||
|
"size" : "40x40" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "ipad", |
||||||
|
"scale" : "1x", |
||||||
|
"size" : "76x76" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "ipad", |
||||||
|
"scale" : "2x", |
||||||
|
"size" : "76x76" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "ipad", |
||||||
|
"scale" : "2x", |
||||||
|
"size" : "83.5x83.5" |
||||||
|
}, |
||||||
|
{ |
||||||
|
"idiom" : "ios-marketing", |
||||||
|
"scale" : "1x", |
||||||
|
"size" : "1024x1024" |
||||||
|
} |
||||||
|
], |
||||||
|
"info" : { |
||||||
|
"author" : "xcode", |
||||||
|
"version" : 1 |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,6 @@ |
|||||||
|
{ |
||||||
|
"info" : { |
||||||
|
"author" : "xcode", |
||||||
|
"version" : 1 |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
import Todo |
||||||
|
|
||||||
|
class ComponentHolder<T> { |
||||||
|
let lifecycle: LifecycleRegistry |
||||||
|
let component: T |
||||||
|
|
||||||
|
init(factory: (ComponentContext) -> T) { |
||||||
|
let lifecycle = LifecycleRegistryKt.LifecycleRegistry() |
||||||
|
let component = factory(DefaultComponentContext(lifecycle: lifecycle)) |
||||||
|
self.lifecycle = lifecycle |
||||||
|
self.component = component |
||||||
|
|
||||||
|
lifecycle.onCreate() |
||||||
|
} |
||||||
|
|
||||||
|
deinit { |
||||||
|
lifecycle.onDestroy() |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,31 @@ |
|||||||
|
import SwiftUI |
||||||
|
import Todo |
||||||
|
|
||||||
|
struct ContentView: View { |
||||||
|
@State |
||||||
|
private var componentHolder = |
||||||
|
ComponentHolder { |
||||||
|
TodoRootKt.TodoRoot( |
||||||
|
componentContext: $0, |
||||||
|
dependencies: RootDependencies() |
||||||
|
) |
||||||
|
} |
||||||
|
|
||||||
|
var body: some View { |
||||||
|
RootView(componentHolder.component) |
||||||
|
.onAppear { LifecycleRegistryExtKt.resume(self.componentHolder.lifecycle) } |
||||||
|
.onDisappear { LifecycleRegistryExtKt.stop(self.componentHolder.lifecycle) } |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private class RootDependencies: TodoRootDependencies { |
||||||
|
let database: TodoDatabase = TodoDatabaseCompanion().invoke(driver: TodoDatabaseDriverFactoryKt.TodoDatabaseDriver()) |
||||||
|
|
||||||
|
let storeFactory: MvikotlinStoreFactory = DefaultStoreFactory() |
||||||
|
} |
||||||
|
|
||||||
|
struct ContentView_Previews: PreviewProvider { |
||||||
|
static var previews: some View { |
||||||
|
ContentView() |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,67 @@ |
|||||||
|
import SwiftUI |
||||||
|
import Todo |
||||||
|
|
||||||
|
struct EditView: View { |
||||||
|
private let component: TodoEdit |
||||||
|
|
||||||
|
@ObservedObject |
||||||
|
private var models: ObservableValue<TodoEditModel> |
||||||
|
|
||||||
|
init(_ component: TodoEdit) { |
||||||
|
self.component = component |
||||||
|
self.models = ObservableValue(component.models) |
||||||
|
} |
||||||
|
|
||||||
|
var body: some View { |
||||||
|
let model = models.value |
||||||
|
let binding = Binding(get: { model.text }, set: component.onTextChanged) |
||||||
|
|
||||||
|
return NavigationView { |
||||||
|
VStack{ |
||||||
|
TextEditor(text: binding) |
||||||
|
.frame(maxHeight: .infinity) |
||||||
|
.padding(8) |
||||||
|
|
||||||
|
HStack { |
||||||
|
Text("Completed") |
||||||
|
Image(systemName: model.isDone ? "checkmark.square" : "square") |
||||||
|
.onTapGesture { self.component.onDoneChanged(isDone: !model.isDone) } |
||||||
|
}.padding(8) |
||||||
|
} |
||||||
|
.navigationBarTitle("Edit todo", displayMode: .inline) |
||||||
|
.navigationBarItems( |
||||||
|
leading: Button(action: { withAnimation { component.onCloseClicked() } } ) { |
||||||
|
HStack { |
||||||
|
Image(systemName: "chevron.left") |
||||||
|
Text("Close") |
||||||
|
} |
||||||
|
} |
||||||
|
) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
struct EditView_Previews: PreviewProvider { |
||||||
|
static var previews: some View { |
||||||
|
EditView(StubTodoEdit()) |
||||||
|
} |
||||||
|
|
||||||
|
class StubTodoEdit: TodoEdit { |
||||||
|
let models: Value<TodoEditModel> = |
||||||
|
valueOf( |
||||||
|
TodoEditModel( |
||||||
|
text: "Text", |
||||||
|
isDone: true |
||||||
|
) |
||||||
|
) |
||||||
|
|
||||||
|
func onCloseClicked() { |
||||||
|
} |
||||||
|
|
||||||
|
func onDoneChanged(isDone: Bool) { |
||||||
|
} |
||||||
|
|
||||||
|
func onTextChanged(text: String) { |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,50 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
||||||
|
<plist version="1.0"> |
||||||
|
<dict> |
||||||
|
<key>CFBundleDevelopmentRegion</key> |
||||||
|
<string>$(DEVELOPMENT_LANGUAGE)</string> |
||||||
|
<key>CFBundleExecutable</key> |
||||||
|
<string>$(EXECUTABLE_NAME)</string> |
||||||
|
<key>CFBundleIdentifier</key> |
||||||
|
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> |
||||||
|
<key>CFBundleInfoDictionaryVersion</key> |
||||||
|
<string>6.0</string> |
||||||
|
<key>CFBundleName</key> |
||||||
|
<string>$(PRODUCT_NAME)</string> |
||||||
|
<key>CFBundlePackageType</key> |
||||||
|
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> |
||||||
|
<key>CFBundleShortVersionString</key> |
||||||
|
<string>1.0</string> |
||||||
|
<key>CFBundleVersion</key> |
||||||
|
<string>1</string> |
||||||
|
<key>LSRequiresIPhoneOS</key> |
||||||
|
<true/> |
||||||
|
<key>UIApplicationSceneManifest</key> |
||||||
|
<dict> |
||||||
|
<key>UIApplicationSupportsMultipleScenes</key> |
||||||
|
<true/> |
||||||
|
</dict> |
||||||
|
<key>UIApplicationSupportsIndirectInputEvents</key> |
||||||
|
<true/> |
||||||
|
<key>UILaunchScreen</key> |
||||||
|
<dict/> |
||||||
|
<key>UIRequiredDeviceCapabilities</key> |
||||||
|
<array> |
||||||
|
<string>armv7</string> |
||||||
|
</array> |
||||||
|
<key>UISupportedInterfaceOrientations</key> |
||||||
|
<array> |
||||||
|
<string>UIInterfaceOrientationPortrait</string> |
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string> |
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string> |
||||||
|
</array> |
||||||
|
<key>UISupportedInterfaceOrientations~ipad</key> |
||||||
|
<array> |
||||||
|
<string>UIInterfaceOrientationPortrait</string> |
||||||
|
<string>UIInterfaceOrientationPortraitUpsideDown</string> |
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string> |
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string> |
||||||
|
</array> |
||||||
|
</dict> |
||||||
|
</plist> |
@ -0,0 +1,28 @@ |
|||||||
|
import SwiftUI |
||||||
|
import Todo |
||||||
|
|
||||||
|
struct InputView: View { |
||||||
|
var textBinding: Binding<String> |
||||||
|
var onAddClicked: () -> Void |
||||||
|
|
||||||
|
var body: some View { |
||||||
|
HStack { |
||||||
|
TextField("Todo text", text: self.textBinding) |
||||||
|
.textFieldStyle(RoundedBorderTextFieldStyle()) |
||||||
|
.edgesIgnoringSafeArea(Edge.Set.bottom) |
||||||
|
|
||||||
|
Button(action: self.onAddClicked) { |
||||||
|
Image(systemName: "plus") |
||||||
|
}.frame(minWidth: 36, minHeight: 36) |
||||||
|
}.padding(8) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
struct InputView_Previews: PreviewProvider { |
||||||
|
static var previews: some View { |
||||||
|
InputView( |
||||||
|
textBinding: Binding(get: { "Text" }, set: {_ in }), |
||||||
|
onAddClicked: {} |
||||||
|
) |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,39 @@ |
|||||||
|
import SwiftUI |
||||||
|
import Todo |
||||||
|
|
||||||
|
struct ListView: View { |
||||||
|
var items: [TodoItem] |
||||||
|
var onItemClicked: (_ id: Int64) -> Void |
||||||
|
var onDoneChanged: (_ id: Int64, _ isDone: Bool) -> Void |
||||||
|
|
||||||
|
var body: some View { |
||||||
|
List(self.items) { item in |
||||||
|
HStack { |
||||||
|
Text(item.text) |
||||||
|
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .leading) |
||||||
|
.background(Color.white) |
||||||
|
.onTapGesture { withAnimation { self.onItemClicked(item.id) } } |
||||||
|
|
||||||
|
Image(systemName: item.isDone ? "checkmark.square" : "square") |
||||||
|
.onTapGesture { self.onDoneChanged(item.id, !item.isDone) } |
||||||
|
} |
||||||
|
}.listStyle(PlainListStyle()) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
struct ListView_Previews: PreviewProvider { |
||||||
|
static var previews: some View { |
||||||
|
ListView( |
||||||
|
items: [ |
||||||
|
TodoItem(id: 1, order: 1, text: "Item 1", isDone: false), |
||||||
|
TodoItem(id: 2, order: 2, text: "Item 2", isDone: true), |
||||||
|
TodoItem(id: 3, order: 3, text: "Item 3", isDone: false) |
||||||
|
], |
||||||
|
onItemClicked: {_ in }, |
||||||
|
onDoneChanged: {_,_ in } |
||||||
|
) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
extension TodoItem : Identifiable { |
||||||
|
} |
@ -0,0 +1,68 @@ |
|||||||
|
import SwiftUI |
||||||
|
import Todo |
||||||
|
|
||||||
|
struct MainView: View { |
||||||
|
private let component: TodoMain |
||||||
|
|
||||||
|
@ObservedObject |
||||||
|
private var models: ObservableValue<TodoMainModel> |
||||||
|
|
||||||
|
init(_ component: TodoMain) { |
||||||
|
self.component = component |
||||||
|
self.models = ObservableValue(component.models) |
||||||
|
} |
||||||
|
|
||||||
|
var body: some View { |
||||||
|
let model = models.value |
||||||
|
|
||||||
|
return NavigationView { |
||||||
|
VStack { |
||||||
|
ListView( |
||||||
|
items: model.items, |
||||||
|
onItemClicked: component.onItemClicked, |
||||||
|
onDoneChanged: component.onItemDoneChanged |
||||||
|
) |
||||||
|
|
||||||
|
InputView( |
||||||
|
textBinding: Binding(get: { model.text }, set: component.onInputTextChanged), |
||||||
|
onAddClicked: component.onAddItemClicked |
||||||
|
) |
||||||
|
}.navigationBarTitle("Todo Sample", displayMode: .inline) |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
struct MainView_Previews: PreviewProvider { |
||||||
|
static var previews: some View { |
||||||
|
MainView(StubTodoMain()) |
||||||
|
} |
||||||
|
|
||||||
|
class StubTodoMain: TodoMain { |
||||||
|
let models: Value<TodoMainModel> = |
||||||
|
valueOf( |
||||||
|
TodoMainModel( |
||||||
|
items: [ |
||||||
|
TodoItem(id: 1, order: 1, text: "Item 1", isDone: false), |
||||||
|
TodoItem(id: 2, order: 2, text: "Item 2", isDone: true), |
||||||
|
TodoItem(id: 3, order: 3, text: "Item 3", isDone: false) |
||||||
|
], |
||||||
|
text: "Text" |
||||||
|
) |
||||||
|
) |
||||||
|
|
||||||
|
func onAddItemClicked() { |
||||||
|
} |
||||||
|
|
||||||
|
func onInputTextChanged(text: String) { |
||||||
|
} |
||||||
|
|
||||||
|
func onItemClicked(id: Int64) { |
||||||
|
} |
||||||
|
|
||||||
|
func onItemDeleteClicked(id: Int64) { |
||||||
|
} |
||||||
|
|
||||||
|
func onItemDoneChanged(id: Int64, isDone: Bool) { |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,5 @@ |
|||||||
|
import Todo |
||||||
|
|
||||||
|
func valueOf<T: AnyObject>(_ value: T) -> Value<T> { |
||||||
|
return MutableValueBuilderKt.MutableValue(initialValue: value) as! MutableValue<T> |
||||||
|
} |
@ -0,0 +1,22 @@ |
|||||||
|
import Todo |
||||||
|
|
||||||
|
public class ObservableValue<T : AnyObject> : ObservableObject { |
||||||
|
private let observableValue: Value<T> |
||||||
|
|
||||||
|
@Published |
||||||
|
var value: T |
||||||
|
|
||||||
|
private var observer: ((T) -> Void)? |
||||||
|
|
||||||
|
init(_ value: Value<T>) { |
||||||
|
self.observableValue = value |
||||||
|
self.value = observableValue.value |
||||||
|
self.observer = { [weak self] value in self?.value = value } |
||||||
|
|
||||||
|
observableValue.subscribe(observer: observer!) |
||||||
|
} |
||||||
|
|
||||||
|
deinit { |
||||||
|
self.observableValue.unsubscribe(observer: self.observer!) |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,6 @@ |
|||||||
|
{ |
||||||
|
"info" : { |
||||||
|
"author" : "xcode", |
||||||
|
"version" : 1 |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,43 @@ |
|||||||
|
import SwiftUI |
||||||
|
import Todo |
||||||
|
|
||||||
|
struct RootView: View { |
||||||
|
@ObservedObject |
||||||
|
private var routerStates: ObservableValue<RouterState<AnyObject, TodoRootChild>> |
||||||
|
|
||||||
|
init(_ component: TodoRoot) { |
||||||
|
self.routerStates = ObservableValue(component.routerState) |
||||||
|
} |
||||||
|
|
||||||
|
var body: some View { |
||||||
|
let child = self.routerStates.value.activeChild.component |
||||||
|
|
||||||
|
switch child { |
||||||
|
case let main as TodoRootChild.Main: |
||||||
|
MainView(main.component) |
||||||
|
|
||||||
|
case let edit as TodoRootChild.Edit: |
||||||
|
EditView(edit.component) |
||||||
|
.transition( |
||||||
|
.asymmetric( |
||||||
|
insertion: AnyTransition.move(edge: .trailing), |
||||||
|
removal: AnyTransition.move(edge: .trailing) |
||||||
|
) |
||||||
|
) |
||||||
|
.animation(.easeInOut) |
||||||
|
|
||||||
|
default: EmptyView() |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
struct RootView_Previews: PreviewProvider { |
||||||
|
static var previews: some View { |
||||||
|
RootView(StubTodoRoot()) |
||||||
|
} |
||||||
|
|
||||||
|
class StubTodoRoot : TodoRoot { |
||||||
|
let routerState: Value<RouterState<AnyObject, TodoRootChild>> = |
||||||
|
simpleRouterState(TodoRootChild.Main(component: MainView_Previews.StubTodoMain())) |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,13 @@ |
|||||||
|
import Todo |
||||||
|
|
||||||
|
func simpleRouterState<T : AnyObject>(_ child: T) -> Value<RouterState<AnyObject, T>> { |
||||||
|
return valueOf( |
||||||
|
RouterState( |
||||||
|
activeChild: RouterStateEntryCreated( |
||||||
|
configuration: "config" as AnyObject, |
||||||
|
component: child |
||||||
|
), |
||||||
|
backStack: [] |
||||||
|
) |
||||||
|
) |
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
import SwiftUI |
||||||
|
|
||||||
|
@main |
||||||
|
struct TodoApp: App { |
||||||
|
var body: some Scene { |
||||||
|
WindowGroup { |
||||||
|
ContentView() |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue