├── iosApp
├── Configuration
│ └── Config.xcconfig
├── iosApp
│ ├── Assets.xcassets
│ │ ├── Contents.json
│ │ ├── AppIcon.appiconset
│ │ │ ├── app-icon-1024.png
│ │ │ └── Contents.json
│ │ └── AccentColor.colorset
│ │ │ └── Contents.json
│ ├── Preview Content
│ │ └── Preview Assets.xcassets
│ │ │ └── Contents.json
│ ├── iOSApp.swift
│ ├── ContentView.swift
│ └── Info.plist
└── iosApp.xcodeproj
│ └── project.pbxproj
├── gradle
├── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
└── libs.versions.toml
├── composeApp
├── src
│ ├── androidMain
│ │ ├── res
│ │ │ ├── values
│ │ │ │ └── strings.xml
│ │ │ ├── mipmap-hdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-mdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-xxxhdpi
│ │ │ │ ├── ic_launcher.png
│ │ │ │ └── ic_launcher_round.png
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ │ └── drawable
│ │ │ │ └── ic_launcher_background.xml
│ │ ├── kotlin
│ │ │ ├── com
│ │ │ │ └── example
│ │ │ │ │ ├── App.kt
│ │ │ │ │ └── MainActivity.kt
│ │ │ └── createDatabaseBuilder.android.kt
│ │ └── AndroidManifest.xml
│ ├── iosMain
│ │ └── kotlin
│ │ │ ├── KoinIOS.kt
│ │ │ ├── MainViewController.kt
│ │ │ └── createDatabaseBuilder.ios.kt
│ ├── commonMain
│ │ ├── composeResources
│ │ │ ├── drawable
│ │ │ │ ├── stock1.jpg
│ │ │ │ ├── stock2.jpg
│ │ │ │ ├── stock3.jpg
│ │ │ │ ├── stock4.jpg
│ │ │ │ └── stock5.jpg
│ │ │ └── values
│ │ │ │ └── strings.xml
│ │ └── kotlin
│ │ │ ├── ui
│ │ │ ├── HomeViewModel.kt
│ │ │ ├── Animations.kt
│ │ │ ├── AddViewModel.kt
│ │ │ ├── HomeScreen.kt
│ │ │ ├── Components.kt
│ │ │ └── AddScreen.kt
│ │ │ ├── Koin.kt
│ │ │ ├── data
│ │ │ ├── Entities.kt
│ │ │ ├── ExpenseDatabase.kt
│ │ │ └── DemoInitializer.kt
│ │ │ └── App.kt
│ └── desktopMain
│ │ └── kotlin
│ │ ├── createDatabaseBuilder.jvm.kt
│ │ └── main.kt
└── build.gradle.kts
├── gradle.properties
├── .gitignore
├── .fleet
└── receipt.json
├── README.md
├── settings.gradle.kts
├── gradlew.bat
└── gradlew
/iosApp/Configuration/Config.xcconfig:
--------------------------------------------------------------------------------
1 | TEAM_ID=
2 | BUNDLE_ID=com.example.EkspenseTrakker
3 | APP_NAME=EkspenseTrakker
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zsmb13/EkspenseTrakker/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/iosApp/iosApp/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
--------------------------------------------------------------------------------
/composeApp/src/androidMain/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | EkspenseTrakker
3 |
--------------------------------------------------------------------------------
/composeApp/src/iosMain/kotlin/KoinIOS.kt:
--------------------------------------------------------------------------------
1 | fun initKoin() {
2 | initKoin(
3 | databaseBuilder = createDatabaseBuilder(),
4 | )
5 | }
6 |
--------------------------------------------------------------------------------
/iosApp/iosApp/Preview Content/Preview Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "author" : "xcode",
4 | "version" : 1
5 | }
6 | }
--------------------------------------------------------------------------------
/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zsmb13/EkspenseTrakker/HEAD/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zsmb13/EkspenseTrakker/HEAD/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zsmb13/EkspenseTrakker/HEAD/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zsmb13/EkspenseTrakker/HEAD/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zsmb13/EkspenseTrakker/HEAD/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/composeApp/src/commonMain/composeResources/drawable/stock1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zsmb13/EkspenseTrakker/HEAD/composeApp/src/commonMain/composeResources/drawable/stock1.jpg
--------------------------------------------------------------------------------
/composeApp/src/commonMain/composeResources/drawable/stock2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zsmb13/EkspenseTrakker/HEAD/composeApp/src/commonMain/composeResources/drawable/stock2.jpg
--------------------------------------------------------------------------------
/composeApp/src/commonMain/composeResources/drawable/stock3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zsmb13/EkspenseTrakker/HEAD/composeApp/src/commonMain/composeResources/drawable/stock3.jpg
--------------------------------------------------------------------------------
/composeApp/src/commonMain/composeResources/drawable/stock4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zsmb13/EkspenseTrakker/HEAD/composeApp/src/commonMain/composeResources/drawable/stock4.jpg
--------------------------------------------------------------------------------
/composeApp/src/commonMain/composeResources/drawable/stock5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zsmb13/EkspenseTrakker/HEAD/composeApp/src/commonMain/composeResources/drawable/stock5.jpg
--------------------------------------------------------------------------------
/composeApp/src/iosMain/kotlin/MainViewController.kt:
--------------------------------------------------------------------------------
1 | import androidx.compose.ui.window.ComposeUIViewController
2 |
3 | fun MainViewController() = ComposeUIViewController { App() }
4 |
--------------------------------------------------------------------------------
/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zsmb13/EkspenseTrakker/HEAD/composeApp/src/androidMain/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zsmb13/EkspenseTrakker/HEAD/composeApp/src/androidMain/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zsmb13/EkspenseTrakker/HEAD/composeApp/src/androidMain/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zsmb13/EkspenseTrakker/HEAD/composeApp/src/androidMain/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zsmb13/EkspenseTrakker/HEAD/composeApp/src/androidMain/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/zsmb13/EkspenseTrakker/HEAD/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/app-icon-1024.png
--------------------------------------------------------------------------------
/iosApp/iosApp/Assets.xcassets/AccentColor.colorset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "colors" : [
3 | {
4 | "idiom" : "universal"
5 | }
6 | ],
7 | "info" : {
8 | "author" : "xcode",
9 | "version" : 1
10 | }
11 | }
--------------------------------------------------------------------------------
/iosApp/iosApp/iOSApp.swift:
--------------------------------------------------------------------------------
1 | import SwiftUI
2 | import ComposeApp
3 |
4 | @main
5 | struct iOSApp: App {
6 | init() {
7 | KoinIOSKt.doInitKoin()
8 | }
9 |
10 | var body: some Scene {
11 | WindowGroup {
12 | ContentView()
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | kotlin.code.style=official
2 | kotlin.daemon.jvmargs=-Xmx2048M
3 |
4 | #Gradle
5 | org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8
6 |
7 | #Android
8 | android.nonTransitiveRClass=true
9 | android.useAndroidX=true
10 |
11 | #MPP
12 | kotlin.native.disableCompilerDaemon=true
13 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/iosApp/iosApp/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "filename" : "app-icon-1024.png",
5 | "idiom" : "universal",
6 | "platform" : "ios",
7 | "size" : "1024x1024"
8 | }
9 | ],
10 | "info" : {
11 | "author" : "xcode",
12 | "version" : 1
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/composeApp/src/androidMain/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/composeApp/src/commonMain/composeResources/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Add expense
3 | Description
4 | Amount
5 | Total: $%1$d
6 | paid by %1$d
7 |
8 |
--------------------------------------------------------------------------------
/composeApp/src/androidMain/kotlin/com/example/App.kt:
--------------------------------------------------------------------------------
1 | package com.example
2 |
3 | import android.app.Application
4 | import createDatabaseBuilder
5 | import initKoin
6 |
7 | class App : Application() {
8 | override fun onCreate() {
9 | super.onCreate()
10 | initKoin(
11 | databaseBuilder = createDatabaseBuilder(this),
12 | )
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .kotlin
3 | .gradle
4 | **/build/
5 | xcuserdata
6 | !src/**/build/
7 | local.properties
8 | .idea
9 | .DS_Store
10 | captures
11 | .externalNativeBuild
12 | .cxx
13 | *.xcodeproj/*
14 | !*.xcodeproj/project.pbxproj
15 | !*.xcodeproj/xcshareddata/
16 | !*.xcodeproj/project.xcworkspace/
17 | !*.xcworkspace/contents.xcworkspacedata
18 | **/xcshareddata/WorkspaceSettings.xcsettings
19 |
--------------------------------------------------------------------------------
/composeApp/src/desktopMain/kotlin/createDatabaseBuilder.jvm.kt:
--------------------------------------------------------------------------------
1 | import androidx.room.Room
2 | import androidx.room.RoomDatabase
3 | import data.ExpenseDatabase
4 | import java.io.File
5 |
6 | fun createDatabaseBuilder(): RoomDatabase.Builder {
7 | val dbFile = File(System.getProperty("java.io.tmpdir"), "my_room.db")
8 | return Room.databaseBuilder(name = dbFile.absolutePath)
9 | }
10 |
--------------------------------------------------------------------------------
/composeApp/src/androidMain/kotlin/com/example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example
2 |
3 | import App
4 | import android.os.Bundle
5 | import androidx.activity.ComponentActivity
6 | import androidx.activity.compose.setContent
7 |
8 | class MainActivity : ComponentActivity() {
9 | override fun onCreate(savedInstanceState: Bundle?) {
10 | super.onCreate(savedInstanceState)
11 |
12 | setContent {
13 | App()
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/.fleet/receipt.json:
--------------------------------------------------------------------------------
1 | // Project generated by Kotlin Multiplatform Wizard
2 | {
3 | "spec": {
4 | "template_id": "kmt",
5 | "targets": {
6 | "android": {
7 | "ui": [
8 | "compose"
9 | ]
10 | },
11 | "ios": {
12 | "ui": [
13 | "compose"
14 | ]
15 | }
16 | }
17 | },
18 | "timestamp": "2024-06-19T09:21:11.390333151Z"
19 | }
--------------------------------------------------------------------------------
/composeApp/src/androidMain/kotlin/createDatabaseBuilder.android.kt:
--------------------------------------------------------------------------------
1 | import android.content.Context
2 | import androidx.room.Room
3 | import androidx.room.RoomDatabase
4 | import data.ExpenseDatabase
5 |
6 | fun createDatabaseBuilder(ctx: Context): RoomDatabase.Builder {
7 | val appContext = ctx.applicationContext
8 | val dbFile = appContext.getDatabasePath("my_room.db")
9 | return Room.databaseBuilder(
10 | context = appContext,
11 | name = dbFile.absolutePath
12 | )
13 | }
14 |
--------------------------------------------------------------------------------
/iosApp/iosApp/ContentView.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import SwiftUI
3 | import ComposeApp
4 |
5 | struct ComposeView: UIViewControllerRepresentable {
6 | func makeUIViewController(context: Context) -> UIViewController {
7 | MainViewControllerKt.MainViewController()
8 | }
9 |
10 | func updateUIViewController(_ uiViewController: UIViewController, context: Context) {}
11 | }
12 |
13 | struct ContentView: View {
14 | var body: some View {
15 | ComposeView()
16 | .ignoresSafeArea(.keyboard) // Compose has own keyboard handler
17 | }
18 | }
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/composeApp/src/commonMain/kotlin/ui/HomeViewModel.kt:
--------------------------------------------------------------------------------
1 | package ui
2 |
3 | import androidx.lifecycle.ViewModel
4 | import androidx.lifecycle.viewModelScope
5 | import data.ExpenseDao
6 | import data.ExpenseWithPerson
7 | import kotlinx.coroutines.flow.SharingStarted
8 | import kotlinx.coroutines.flow.StateFlow
9 | import kotlinx.coroutines.flow.stateIn
10 |
11 | class HomeViewModel(
12 | private val expenseDao: ExpenseDao,
13 | ) : ViewModel() {
14 | val expenses: StateFlow> = expenseDao
15 | .getAllWithPeople()
16 | .stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), emptyList())
17 | }
18 |
--------------------------------------------------------------------------------
/composeApp/src/commonMain/kotlin/Koin.kt:
--------------------------------------------------------------------------------
1 | import androidx.room.RoomDatabase
2 | import data.ExpenseDao
3 | import data.ExpenseDatabase
4 | import data.getRoomDatabase
5 | import org.koin.compose.viewmodel.dsl.viewModel
6 | import org.koin.core.context.startKoin
7 | import org.koin.dsl.module
8 | import ui.AddViewModel
9 | import ui.HomeViewModel
10 |
11 | fun initKoin(
12 | databaseBuilder: RoomDatabase.Builder,
13 | ) {
14 | val dataModule = module {
15 | single { databaseBuilder.getRoomDatabase() }
16 | single { get().expenseDao() }
17 | }
18 |
19 | val viewModelModule = module {
20 | viewModel { HomeViewModel(get()) }
21 | viewModel { AddViewModel(get()) }
22 | }
23 |
24 | startKoin {
25 | modules(dataModule, viewModelModule)
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | This is a Kotlin Multiplatform project targeting Android, iOS.
2 |
3 | * `/composeApp` is for code that will be shared across your Compose Multiplatform applications.
4 | It contains several subfolders:
5 | - `commonMain` is for code that’s common for all targets.
6 | - Other folders are for Kotlin code that will be compiled for only the platform indicated in the folder name.
7 | For example, if you want to use Apple’s CoreCrypto for the iOS part of your Kotlin app,
8 | `iosMain` would be the right folder for such calls.
9 |
10 | * `/iosApp` contains iOS applications. Even if you’re sharing your UI with Compose Multiplatform,
11 | you need this entry point for your iOS app. This is also where you should add SwiftUI code for your project.
12 |
13 |
14 | Learn more about [Kotlin Multiplatform](https://www.jetbrains.com/help/kotlin-multiplatform-dev/get-started.html)…
--------------------------------------------------------------------------------
/settings.gradle.kts:
--------------------------------------------------------------------------------
1 | rootProject.name = "EkspenseTrakker"
2 | enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
3 |
4 | pluginManagement {
5 | repositories {
6 | google {
7 | mavenContent {
8 | includeGroupAndSubgroups("androidx")
9 | includeGroupAndSubgroups("com.android")
10 | includeGroupAndSubgroups("com.google")
11 | }
12 | }
13 | mavenCentral()
14 | gradlePluginPortal()
15 | }
16 | }
17 |
18 | dependencyResolutionManagement {
19 | repositories {
20 | google {
21 | mavenContent {
22 | includeGroupAndSubgroups("androidx")
23 | includeGroupAndSubgroups("com.android")
24 | includeGroupAndSubgroups("com.google")
25 | }
26 | }
27 | mavenCentral()
28 | }
29 | }
30 |
31 | include(":composeApp")
--------------------------------------------------------------------------------
/composeApp/src/commonMain/kotlin/data/Entities.kt:
--------------------------------------------------------------------------------
1 | package data
2 |
3 | import androidx.room.*
4 |
5 | @Entity(
6 | tableName = "expenses",
7 | foreignKeys = [
8 | ForeignKey(
9 | entity = Person::class,
10 | parentColumns = ["id"],
11 | childColumns = ["paidByPersonId"],
12 | ),
13 | ],
14 | )
15 | data class Expense(
16 | @PrimaryKey(autoGenerate = true)
17 | val id: Long = 0L,
18 | val paidByPersonId: Long,
19 | val amount: Int,
20 | val description: String,
21 | )
22 |
23 | @Entity(tableName = "people")
24 | data class Person(
25 | @PrimaryKey(autoGenerate = true)
26 | val id: Long = 0L,
27 | val name: String,
28 | )
29 |
30 | data class ExpenseWithPerson(
31 | @Embedded
32 | val expense: Expense,
33 |
34 | @Relation(
35 | parentColumn = "paidByPersonId",
36 | entityColumn = "id",
37 | )
38 | val paidBy: Person,
39 | )
40 |
--------------------------------------------------------------------------------
/composeApp/src/commonMain/kotlin/ui/Animations.kt:
--------------------------------------------------------------------------------
1 | package ui
2 |
3 | import androidx.compose.animation.*
4 | import androidx.compose.animation.core.tween
5 | import androidx.navigation.NavBackStackEntry
6 |
7 |
8 | val enterT: (AnimatedContentTransitionScope.() -> EnterTransition) = {
9 | slideIntoContainer(
10 | AnimatedContentTransitionScope.SlideDirection.Start,
11 | animationSpec = tween(400)
12 | )
13 | }
14 |
15 | val exitT: (AnimatedContentTransitionScope.() -> ExitTransition) = {
16 | fadeOut(tween(800))
17 | }
18 |
19 | val popExitT: (AnimatedContentTransitionScope.() -> ExitTransition) = {
20 | slideOutOfContainer(
21 | AnimatedContentTransitionScope.SlideDirection.End,
22 | animationSpec = tween(400)
23 | )
24 | }
25 |
26 | val popEnterT: (AnimatedContentTransitionScope.() -> EnterTransition) = {
27 | fadeIn()
28 | }
29 |
--------------------------------------------------------------------------------
/composeApp/src/iosMain/kotlin/createDatabaseBuilder.ios.kt:
--------------------------------------------------------------------------------
1 | import androidx.room.Room
2 | import androidx.room.RoomDatabase
3 | import data.ExpenseDatabase
4 | import kotlinx.cinterop.ExperimentalForeignApi
5 | import platform.Foundation.NSDocumentDirectory
6 | import platform.Foundation.NSFileManager
7 | import platform.Foundation.NSHomeDirectory
8 | import platform.Foundation.NSUserDomainMask
9 |
10 | fun createDatabaseBuilder(): RoomDatabase.Builder {
11 | val dbFilePath = documentDirectory() + "/my_room.db"
12 | return Room.databaseBuilder(
13 | name = dbFilePath,
14 | )
15 | }
16 |
17 |
18 | @OptIn(ExperimentalForeignApi::class)
19 | private fun documentDirectory(): String {
20 | val documentDirectory = NSFileManager.defaultManager.URLForDirectory(
21 | directory = NSDocumentDirectory,
22 | inDomain = NSUserDomainMask,
23 | appropriateForURL = null,
24 | create = false,
25 | error = null,
26 | )
27 | return requireNotNull(documentDirectory?.path)
28 | }
--------------------------------------------------------------------------------
/composeApp/src/commonMain/kotlin/ui/AddViewModel.kt:
--------------------------------------------------------------------------------
1 | package ui
2 |
3 | import androidx.lifecycle.ViewModel
4 | import androidx.lifecycle.viewModelScope
5 | import data.Expense
6 | import data.ExpenseDao
7 | import data.Person
8 | import kotlinx.coroutines.flow.*
9 | import kotlinx.coroutines.launch
10 |
11 | class AddViewModel(
12 | private val expenseDao: ExpenseDao,
13 | ) : ViewModel() {
14 | val people: StateFlow> = expenseDao.getAllPeople()
15 | .stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), emptyList())
16 |
17 | private val _recordCreated = MutableStateFlow(false)
18 | val recordCreated: StateFlow = _recordCreated
19 |
20 | fun createRecord(amount: Int, description: String, personId: Long) {
21 | val expense = Expense(
22 | paidByPersonId = personId,
23 | amount = amount,
24 | description = description,
25 | )
26 |
27 | viewModelScope.launch {
28 | expenseDao.insert(expense)
29 | _recordCreated.update { true }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/composeApp/src/androidMain/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/composeApp/src/commonMain/kotlin/App.kt:
--------------------------------------------------------------------------------
1 | import androidx.compose.foundation.layout.fillMaxSize
2 | import androidx.compose.material.MaterialTheme
3 | import androidx.compose.material.Surface
4 | import androidx.compose.runtime.Composable
5 | import androidx.compose.ui.Modifier
6 | import androidx.navigation.compose.NavHost
7 | import androidx.navigation.compose.composable
8 | import androidx.navigation.compose.rememberNavController
9 | import data.DemoInitializer
10 | import kotlinx.serialization.Serializable
11 | import ui.*
12 |
13 | @Serializable
14 | data object HomeRoute
15 |
16 | @Serializable
17 | data object AddRoute
18 |
19 | @Composable
20 | fun App() {
21 | MaterialTheme {
22 | // TODO remove hardcoded init
23 | DemoInitializer()
24 |
25 | Surface(Modifier.fillMaxSize()) {
26 | val navController = rememberNavController()
27 | NavHost(
28 | navController,
29 | startDestination = HomeRoute,
30 | enterTransition = enterT,
31 | exitTransition = exitT,
32 | popEnterTransition = popEnterT,
33 | popExitTransition = popExitT,
34 | ) {
35 | composable {
36 | HomeScreen(onAddNewRecord = { navController.navigate(AddRoute) })
37 | }
38 | composable {
39 | AddScreen(onDone = { navController.navigateUp() })
40 | }
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/composeApp/src/commonMain/kotlin/data/ExpenseDatabase.kt:
--------------------------------------------------------------------------------
1 | package data
2 |
3 | import androidx.room.*
4 | import androidx.sqlite.driver.bundled.BundledSQLiteDriver
5 | import kotlinx.coroutines.Dispatchers
6 | import kotlinx.coroutines.IO
7 | import kotlinx.coroutines.flow.Flow
8 |
9 | expect object MyDatabaseCtor : RoomDatabaseConstructor
10 |
11 | @Database(entities = [Expense::class, Person::class], version = 1)
12 | @ConstructedBy(MyDatabaseCtor::class)
13 | abstract class ExpenseDatabase : RoomDatabase() {
14 | abstract fun expenseDao(): ExpenseDao
15 | }
16 |
17 | fun RoomDatabase.Builder.getRoomDatabase(): ExpenseDatabase {
18 | return this
19 | .fallbackToDestructiveMigration(dropAllTables = true)
20 | .setDriver(BundledSQLiteDriver())
21 | .setQueryCoroutineContext(Dispatchers.IO)
22 | .build()
23 | }
24 |
25 | @Dao
26 | interface ExpenseDao {
27 | @Transaction
28 | @Query("SELECT * FROM expenses")
29 | fun getAllWithPeople(): Flow>
30 |
31 | @Query("SELECT * FROM people")
32 | fun getAllPeople(): Flow>
33 |
34 | @Insert
35 | suspend fun insert(expense: Expense)
36 |
37 | @Insert
38 | suspend fun insert(person: Person)
39 |
40 | @Transaction
41 | suspend fun deleteAll() {
42 | deleteAllExpenses()
43 | deleteAllPeople()
44 | }
45 |
46 | @Query("DELETE FROM expenses")
47 | suspend fun deleteAllExpenses()
48 |
49 | @Query("DELETE FROM people")
50 | suspend fun deleteAllPeople()
51 | }
52 |
--------------------------------------------------------------------------------
/iosApp/iosApp/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | CADisableMinimumFrameDurationOnPhone
24 |
25 | UIApplicationSceneManifest
26 |
27 | UIApplicationSupportsMultipleScenes
28 |
29 |
30 | UILaunchScreen
31 |
32 | UIRequiredDeviceCapabilities
33 |
34 | armv7
35 |
36 | UISupportedInterfaceOrientations
37 |
38 | UIInterfaceOrientationPortrait
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UISupportedInterfaceOrientations~ipad
43 |
44 | UIInterfaceOrientationPortrait
45 | UIInterfaceOrientationPortraitUpsideDown
46 | UIInterfaceOrientationLandscapeLeft
47 | UIInterfaceOrientationLandscapeRight
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/composeApp/src/desktopMain/kotlin/main.kt:
--------------------------------------------------------------------------------
1 | import androidx.compose.foundation.Image
2 | import androidx.compose.foundation.layout.Box
3 | import androidx.compose.foundation.layout.fillMaxSize
4 | import androidx.compose.runtime.*
5 | import androidx.compose.ui.Alignment
6 | import androidx.compose.ui.Modifier
7 | import androidx.compose.ui.unit.dp
8 | import androidx.compose.ui.window.Window
9 | import androidx.compose.ui.window.application
10 | import androidx.compose.ui.window.rememberWindowState
11 | import ekspensetrakker.composeapp.generated.resources.Res
12 | import ekspensetrakker.composeapp.generated.resources.ipad
13 | import org.jetbrains.compose.resources.imageResource
14 |
15 |
16 | fun main() {
17 | initKoin(
18 | databaseBuilder = createDatabaseBuilder(),
19 | )
20 |
21 | application {
22 | val state = rememberWindowState()
23 | var squashed by remember { mutableStateOf(false) }
24 |
25 | val zeroHeight by derivedStateOf {
26 | state.size.height <= 30.dp
27 | }
28 | LaunchedEffect(zeroHeight) {
29 | if (zeroHeight) squashed = true
30 | }
31 |
32 | Window(
33 | onCloseRequest = ::exitApplication,
34 | state = state,
35 | title = when {
36 | zeroHeight -> "-------"
37 | squashed -> "iPad Pro 2024 ad"
38 | else -> "Expense Tracker!"
39 | }
40 | ) {
41 | Box(contentAlignment = Alignment.BottomCenter, modifier = Modifier.fillMaxSize()) {
42 | if (squashed) {
43 | Image(imageResource(Res.drawable.ipad), "iPad Pro 2024")
44 | } else {
45 | App()
46 | }
47 | }
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/composeApp/src/androidMain/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/composeApp/src/commonMain/kotlin/data/DemoInitializer.kt:
--------------------------------------------------------------------------------
1 | package data
2 |
3 | import androidx.compose.runtime.Composable
4 | import androidx.compose.runtime.LaunchedEffect
5 | import ekspensetrakker.composeapp.generated.resources.Res
6 | import ekspensetrakker.composeapp.generated.resources.*
7 | import org.jetbrains.compose.resources.DrawableResource
8 | import org.koin.compose.koinInject
9 |
10 | val demoPeople = listOf(
11 | Person(1, "Alex"),
12 | Person(2, "Blake"),
13 | Person(3, "Casey"),
14 | Person(4, "Drew"),
15 | Person(5, "Erin"),
16 | )
17 |
18 | val demoExpenses = listOf(
19 | Expense(paidByPersonId = demoPeople.random().id, amount = 129, description = "Business trip"),
20 | Expense(paidByPersonId = demoPeople.random().id, amount = 12, description = "Kodee Meet & Greet"),
21 | Expense(paidByPersonId = demoPeople.random().id, amount = 57, description = "Standard Library Card"),
22 | Expense(paidByPersonId = demoPeople.random().id, amount = 86, description = "droidcon Moon Tickets"),
23 | Expense(paidByPersonId = demoPeople.random().id, amount = 3, description = "Cat Tax 🐱"),
24 | Expense(paidByPersonId = demoPeople.random().id, amount = 8, description = "Omea License"),
25 | Expense(paidByPersonId = demoPeople.random().id, amount = 60, description = "Multiplatform Multivitamins"),
26 | Expense(paidByPersonId = demoPeople.random().id, amount = 12, description = "Kotlin in Action, 2nd Edition"),
27 | )
28 |
29 | private val demoAvatars = listOf(
30 | Res.drawable.stock1,
31 | Res.drawable.stock2,
32 | Res.drawable.stock3,
33 | Res.drawable.stock4,
34 | Res.drawable.stock5,
35 | )
36 |
37 | val peopleToAvatars: Map = demoPeople.zip(demoAvatars).toMap()
38 |
39 | @Composable
40 | fun DemoInitializer() {
41 | val expenseDao: ExpenseDao = koinInject()
42 | LaunchedEffect(Unit) {
43 | expenseDao.deleteAll()
44 | demoPeople.forEach { expenseDao.insert(it) }
45 | demoExpenses.forEach { expenseDao.insert(it) }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/composeApp/src/commonMain/kotlin/ui/HomeScreen.kt:
--------------------------------------------------------------------------------
1 | package ui
2 |
3 | import androidx.compose.foundation.background
4 | import androidx.compose.foundation.clickable
5 | import androidx.compose.foundation.layout.*
6 | import androidx.compose.foundation.lazy.LazyColumn
7 | import androidx.compose.foundation.lazy.items
8 | import androidx.compose.material.Button
9 | import androidx.compose.material.MaterialTheme
10 | import androidx.compose.material.Text
11 | import androidx.compose.runtime.Composable
12 | import androidx.compose.runtime.getValue
13 | import androidx.compose.runtime.remember
14 | import androidx.compose.ui.Alignment
15 | import androidx.compose.ui.Modifier
16 | import androidx.compose.ui.unit.dp
17 | import androidx.compose.ui.unit.sp
18 | import androidx.lifecycle.compose.collectAsStateWithLifecycle
19 | import ekspensetrakker.composeapp.generated.resources.Res
20 | import ekspensetrakker.composeapp.generated.resources.add_expense
21 | import ekspensetrakker.composeapp.generated.resources.total
22 | import org.jetbrains.compose.resources.stringResource
23 | import org.koin.compose.viewmodel.koinViewModel
24 | import org.koin.core.annotation.KoinExperimentalAPI
25 |
26 | @OptIn(KoinExperimentalAPI::class)
27 | @Composable
28 | fun HomeScreen(
29 | onAddNewRecord: () -> Unit,
30 | viewModel: HomeViewModel = koinViewModel(),
31 | ) {
32 | val expenses by viewModel.expenses.collectAsStateWithLifecycle()
33 |
34 | val total = remember(expenses) { expenses.sumOf { it.expense.amount } }
35 |
36 | Column(Modifier.fillMaxSize().padding(8.dp), horizontalAlignment = Alignment.CenterHorizontally) {
37 | LazyColumn(Modifier.fillMaxWidth().weight(1f)) {
38 | items(expenses) {
39 | ExpenseItem(expense = it.expense, paidBy = it.paidBy)
40 | }
41 | }
42 | Spacer(
43 | Modifier.padding(5.dp).height(2.dp).fillMaxWidth().background(MaterialTheme.colors.primary)
44 | )
45 | Text(stringResource(Res.string.total, total), fontSize = 24.sp, modifier = Modifier.padding(16.dp))
46 | Button(onClick = { onAddNewRecord() }) {
47 | Text(stringResource(Res.string.add_expense))
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/gradle/libs.versions.toml:
--------------------------------------------------------------------------------
1 | [versions]
2 | agp = "8.6.1"
3 | android-compileSdk = "34"
4 | android-minSdk = "24"
5 | android-targetSdk = "34"
6 | androidx-activityCompose = "1.9.2"
7 | androidx-room = "2.7.0-alpha09"
8 | compose-plugin = "1.7.0"
9 | androidx-lifecycle = "2.8.2"
10 | androidx-navigation = "2.8.0-alpha10"
11 | kotlin = "2.0.21"
12 | ksp = "2.0.21-1.0.25"
13 | sqlite = "2.5.0-alpha09"
14 | koin-compose = "4.0.0"
15 | kotlinx-coroutines = "1.9.0"
16 | kotlinx-serialization = "1.7.3"
17 |
18 | [libraries]
19 | androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
20 | androidx-room-compiler = { group = "androidx.room", name = "room-compiler", version.ref = "androidx-room" }
21 | androidx-room-runtime = { group = "androidx.room", name = "room-runtime", version.ref = "androidx-room" }
22 | sqlite-bundled = { module = "androidx.sqlite:sqlite-bundled", version.ref = "sqlite" }
23 | koin-compose-viewmodel = { module = "io.insert-koin:koin-compose-viewmodel", version.ref = "koin-compose" }
24 | navigation-compose = { module = "org.jetbrains.androidx.navigation:navigation-compose", version.ref = "androidx-navigation" }
25 | lifecycle-viewmodel = { module = "org.jetbrains.androidx.lifecycle:lifecycle-viewmodel", version.ref = "androidx-lifecycle" }
26 | lifecycle-runtime-compose = { module = "org.jetbrains.androidx.lifecycle:lifecycle-runtime-compose", version.ref = "androidx-lifecycle" }
27 | kotlinx-coroutines-swing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" }
28 | kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinx-serialization" }
29 |
30 | [plugins]
31 | androidApplication = { id = "com.android.application", version.ref = "agp" }
32 | androidLibrary = { id = "com.android.library", version.ref = "agp" }
33 | jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }
34 | compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
35 | kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
36 | kotlinxSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
37 | ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
38 |
--------------------------------------------------------------------------------
/composeApp/src/commonMain/kotlin/ui/Components.kt:
--------------------------------------------------------------------------------
1 | package ui
2 |
3 | import androidx.compose.foundation.Image
4 | import androidx.compose.foundation.background
5 | import androidx.compose.foundation.layout.*
6 | import androidx.compose.foundation.shape.CircleShape
7 | import androidx.compose.material.Text
8 | import androidx.compose.runtime.Composable
9 | import androidx.compose.runtime.remember
10 | import androidx.compose.ui.Alignment
11 | import androidx.compose.ui.Modifier
12 | import androidx.compose.ui.draw.clip
13 | import androidx.compose.ui.graphics.Color
14 | import androidx.compose.ui.layout.ContentScale
15 | import androidx.compose.ui.unit.dp
16 | import androidx.compose.ui.unit.sp
17 | import data.Expense
18 | import data.Person
19 | import data.peopleToAvatars
20 | import ekspensetrakker.composeapp.generated.resources.Res
21 | import ekspensetrakker.composeapp.generated.resources.paid_by
22 | import org.jetbrains.compose.resources.imageResource
23 | import org.jetbrains.compose.resources.stringResource
24 | import org.jetbrains.compose.ui.tooling.preview.Preview
25 |
26 | @Preview
27 | @Composable
28 | fun PersonItemPreview() {
29 | PersonItem(Person(2, "Blake"))
30 | }
31 |
32 | @Composable
33 | fun PersonItem(person: Person, modifier: Modifier = Modifier) {
34 | Column(modifier.padding(12.dp), horizontalAlignment = Alignment.CenterHorizontally) {
35 | Avatar(person)
36 | Spacer(Modifier.size(8.dp))
37 | Text(person.name)
38 | }
39 | }
40 |
41 | @Composable
42 | fun Avatar(person: Person, modifier: Modifier = Modifier) {
43 | val color = remember(person) { Color(120, person.name.hashCode() % 255, 100) }
44 |
45 | Box(modifier.size(48.dp).clip(CircleShape).background(color)) {
46 | peopleToAvatars[person]?.let {
47 | Image(
48 | bitmap = imageResource(it),
49 | contentDescription = person.name,
50 | modifier = Modifier.fillMaxSize(),
51 | contentScale = ContentScale.Crop,
52 | )
53 | }
54 | }
55 | }
56 |
57 | @Preview
58 | @Composable
59 | fun ExpenseItemPreview() {
60 | ExpenseItem(
61 | expense = Expense(0, 2, 20, "Real business expense"),
62 | paidBy = Person(2, "Blake"),
63 | )
64 | }
65 |
66 | @Composable
67 | fun ExpenseItem(expense: Expense, paidBy: Person) {
68 | Row(Modifier.fillMaxWidth().padding(16.dp), verticalAlignment = Alignment.CenterVertically) {
69 | Avatar(paidBy, Modifier.size(40.dp))
70 | Column(Modifier.padding(horizontal = 16.dp).weight(1f)) {
71 | Text(expense.description, fontSize = 20.sp)
72 | Text(stringResource(Res.string.paid_by, paidBy.name))
73 | }
74 | Text("$${expense.amount}")
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 |
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 |
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 |
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 |
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 |
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 |
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 |
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 |
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 |
54 | goto fail
55 |
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 |
60 | if exist "%JAVA_EXE%" goto execute
61 |
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 |
68 | goto fail
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74 |
75 |
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78 |
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 |
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 |
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 |
94 | :omega
95 |
--------------------------------------------------------------------------------
/composeApp/build.gradle.kts:
--------------------------------------------------------------------------------
1 | import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
2 | import org.jetbrains.kotlin.gradle.dsl.JvmTarget
3 |
4 | plugins {
5 | alias(libs.plugins.kotlinMultiplatform)
6 | alias(libs.plugins.androidApplication)
7 | alias(libs.plugins.jetbrainsCompose)
8 | alias(libs.plugins.compose.compiler)
9 | alias(libs.plugins.ksp)
10 | alias(libs.plugins.kotlinxSerialization)
11 | }
12 |
13 | kotlin {
14 | androidTarget {
15 | @OptIn(ExperimentalKotlinGradlePluginApi::class)
16 | compilerOptions {
17 | jvmTarget.set(JvmTarget.JVM_11)
18 | }
19 | }
20 |
21 | jvm("desktop")
22 |
23 | listOf(
24 | iosX64(),
25 | iosArm64(),
26 | iosSimulatorArm64()
27 | ).forEach { iosTarget ->
28 | iosTarget.binaries.framework {
29 | baseName = "ComposeApp"
30 | isStatic = true
31 | }
32 | }
33 |
34 | sourceSets {
35 | val desktopMain by getting
36 |
37 | androidMain.dependencies {
38 | implementation(compose.preview)
39 | implementation(libs.androidx.activity.compose)
40 | }
41 | desktopMain.dependencies {
42 | implementation(compose.desktop.currentOs)
43 | implementation(libs.kotlinx.coroutines.swing)
44 | }
45 | commonMain.dependencies {
46 | implementation(compose.runtime)
47 | implementation(compose.foundation)
48 | implementation(compose.material)
49 | implementation(compose.ui)
50 | implementation(compose.components.resources)
51 | implementation(compose.components.uiToolingPreview)
52 |
53 | implementation(libs.androidx.room.runtime)
54 | implementation(libs.sqlite.bundled)
55 | implementation(libs.koin.compose.viewmodel)
56 | implementation(libs.kotlinx.serialization.core)
57 | implementation(libs.navigation.compose)
58 | implementation(libs.lifecycle.viewmodel)
59 | implementation(libs.lifecycle.runtime.compose)
60 | }
61 | }
62 | }
63 |
64 | android {
65 | namespace = "com.example"
66 | compileSdk = libs.versions.android.compileSdk.get().toInt()
67 |
68 | defaultConfig {
69 | applicationId = "com.example"
70 | minSdk = libs.versions.android.minSdk.get().toInt()
71 | targetSdk = libs.versions.android.targetSdk.get().toInt()
72 | versionCode = 1
73 | versionName = "1.0"
74 | }
75 | packaging {
76 | resources {
77 | excludes += "/META-INF/{AL2.0,LGPL2.1}"
78 | }
79 | }
80 | buildTypes {
81 | getByName("release") {
82 | isMinifyEnabled = false
83 | }
84 | }
85 | compileOptions {
86 | sourceCompatibility = JavaVersion.VERSION_11
87 | targetCompatibility = JavaVersion.VERSION_11
88 | }
89 | }
90 |
91 | compose.desktop.application.mainClass = "MainKt"
92 |
93 | dependencies {
94 | debugImplementation(compose.uiTooling)
95 |
96 | add("kspAndroid", libs.androidx.room.compiler)
97 | add("kspIosSimulatorArm64", libs.androidx.room.compiler)
98 | add("kspIosX64", libs.androidx.room.compiler)
99 | add("kspIosArm64", libs.androidx.room.compiler)
100 | add("kspDesktop", libs.androidx.room.compiler)
101 | }
102 |
--------------------------------------------------------------------------------
/composeApp/src/commonMain/kotlin/ui/AddScreen.kt:
--------------------------------------------------------------------------------
1 | package ui
2 |
3 | import androidx.compose.animation.animateColorAsState
4 | import androidx.compose.animation.core.tween
5 | import androidx.compose.foundation.border
6 | import androidx.compose.foundation.clickable
7 | import androidx.compose.foundation.layout.*
8 | import androidx.compose.foundation.lazy.LazyRow
9 | import androidx.compose.foundation.lazy.items
10 | import androidx.compose.foundation.shape.RoundedCornerShape
11 | import androidx.compose.foundation.text.KeyboardOptions
12 | import androidx.compose.material.*
13 | import androidx.compose.material.icons.Icons
14 | import androidx.compose.material.icons.automirrored.filled.ArrowBack
15 | import androidx.compose.runtime.*
16 | import androidx.compose.ui.Alignment
17 | import androidx.compose.ui.Modifier
18 | import androidx.compose.ui.draw.clip
19 | import androidx.compose.ui.graphics.Color
20 | import androidx.compose.ui.text.input.KeyboardType
21 | import androidx.compose.ui.text.style.TextAlign
22 | import androidx.compose.ui.unit.dp
23 | import androidx.compose.ui.unit.sp
24 | import androidx.lifecycle.compose.collectAsStateWithLifecycle
25 | import ekspensetrakker.composeapp.generated.resources.Res
26 | import ekspensetrakker.composeapp.generated.resources.add_expense
27 | import ekspensetrakker.composeapp.generated.resources.amount
28 | import ekspensetrakker.composeapp.generated.resources.description
29 | import org.jetbrains.compose.resources.stringResource
30 | import org.koin.compose.viewmodel.koinViewModel
31 | import org.koin.core.annotation.KoinExperimentalAPI
32 |
33 | @OptIn(KoinExperimentalAPI::class)
34 | @Composable
35 | fun AddScreen(
36 | onDone: () -> Unit,
37 | viewModel: AddViewModel = koinViewModel(),
38 | ) {
39 | val recordCreated by viewModel.recordCreated.collectAsStateWithLifecycle()
40 | LaunchedEffect(recordCreated) {
41 | if (recordCreated) onDone()
42 | }
43 |
44 | var amount by remember { mutableStateOf("") }
45 | var description by remember { mutableStateOf("") }
46 | var personId by remember { mutableStateOf(null) }
47 |
48 |
49 | val people by viewModel.people.collectAsStateWithLifecycle()
50 |
51 | Surface(Modifier.fillMaxSize()) {
52 | Column(
53 | modifier = Modifier.fillMaxSize().padding(vertical = 20.dp, horizontal = 8.dp),
54 | horizontalAlignment = Alignment.CenterHorizontally,
55 | ) {
56 | IconButton(onClick = onDone, Modifier.align(Alignment.Start)) {
57 | Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
58 | }
59 | Spacer(Modifier.height(70.dp))
60 | val roundedShape = remember { RoundedCornerShape(12.dp) }
61 | LazyRow {
62 | items(people) { person ->
63 | val borderColor by animateColorAsState(
64 | when (person.id) {
65 | personId -> MaterialTheme.colors.primary
66 | else -> Color.Transparent
67 | },
68 | animationSpec = tween(200),
69 | )
70 | PersonItem(
71 | person = person,
72 | modifier = Modifier
73 | .clip(roundedShape)
74 | .border(2.dp, borderColor, roundedShape)
75 | .clickable { personId = person.id },
76 | )
77 | }
78 | }
79 |
80 | TextField(
81 | value = amount,
82 | onValueChange = { amount = it.filter(Char::isDigit) },
83 | textStyle = LocalTextStyle.current.copy(fontSize = 30.sp, textAlign = TextAlign.Center),
84 | label = { Text(stringResource(Res.string.amount)) },
85 | keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.Number),
86 | modifier = Modifier.padding(vertical = 24.dp).widthIn(max = 200.dp),
87 | )
88 |
89 | TextField(
90 | value = description,
91 | onValueChange = { description = it },
92 | label = { Text(stringResource(Res.string.description)) },
93 | modifier = Modifier.padding(bottom = 24.dp)
94 | )
95 |
96 | Button(
97 | onClick = { viewModel.createRecord(amount.toInt(), description, requireNotNull(personId)) },
98 | enabled = personId != null && amount.toIntOrNull() != null,
99 | ) {
100 | Text(stringResource(Res.string.add_expense))
101 | }
102 | }
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/composeApp/src/androidMain/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 | # SPDX-License-Identifier: Apache-2.0
19 | #
20 |
21 | ##############################################################################
22 | #
23 | # Gradle start up script for POSIX generated by Gradle.
24 | #
25 | # Important for running:
26 | #
27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
28 | # noncompliant, but you have some other compliant shell such as ksh or
29 | # bash, then to run this script, type that shell name before the whole
30 | # command line, like:
31 | #
32 | # ksh Gradle
33 | #
34 | # Busybox and similar reduced shells will NOT work, because this script
35 | # requires all of these POSIX shell features:
36 | # * functions;
37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
39 | # * compound commands having a testable exit status, especially «case»;
40 | # * various built-in commands including «command», «set», and «ulimit».
41 | #
42 | # Important for patching:
43 | #
44 | # (2) This script targets any POSIX shell, so it avoids extensions provided
45 | # by Bash, Ksh, etc; in particular arrays are avoided.
46 | #
47 | # The "traditional" practice of packing multiple parameters into a
48 | # space-separated string is a well documented source of bugs and security
49 | # problems, so this is (mostly) avoided, by progressively accumulating
50 | # options in "$@", and eventually passing that to Java.
51 | #
52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
54 | # see the in-line comments for details.
55 | #
56 | # There are tweaks for specific operating systems such as AIX, CygWin,
57 | # Darwin, MinGW, and NonStop.
58 | #
59 | # (3) This script is generated from the Groovy template
60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
61 | # within the Gradle project.
62 | #
63 | # You can find Gradle at https://github.com/gradle/gradle/.
64 | #
65 | ##############################################################################
66 |
67 | # Attempt to set APP_HOME
68 |
69 | # Resolve links: $0 may be a link
70 | app_path=$0
71 |
72 | # Need this for daisy-chained symlinks.
73 | while
74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
75 | [ -h "$app_path" ]
76 | do
77 | ls=$( ls -ld "$app_path" )
78 | link=${ls#*' -> '}
79 | case $link in #(
80 | /*) app_path=$link ;; #(
81 | *) app_path=$APP_HOME$link ;;
82 | esac
83 | done
84 |
85 | # This is normally unused
86 | # shellcheck disable=SC2034
87 | APP_BASE_NAME=${0##*/}
88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90 | ' "$PWD" ) || exit
91 |
92 | # Use the maximum available, or set MAX_FD != -1 to use that value.
93 | MAX_FD=maximum
94 |
95 | warn () {
96 | echo "$*"
97 | } >&2
98 |
99 | die () {
100 | echo
101 | echo "$*"
102 | echo
103 | exit 1
104 | } >&2
105 |
106 | # OS specific support (must be 'true' or 'false').
107 | cygwin=false
108 | msys=false
109 | darwin=false
110 | nonstop=false
111 | case "$( uname )" in #(
112 | CYGWIN* ) cygwin=true ;; #(
113 | Darwin* ) darwin=true ;; #(
114 | MSYS* | MINGW* ) msys=true ;; #(
115 | NONSTOP* ) nonstop=true ;;
116 | esac
117 |
118 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
119 |
120 |
121 | # Determine the Java command to use to start the JVM.
122 | if [ -n "$JAVA_HOME" ] ; then
123 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
124 | # IBM's JDK on AIX uses strange locations for the executables
125 | JAVACMD=$JAVA_HOME/jre/sh/java
126 | else
127 | JAVACMD=$JAVA_HOME/bin/java
128 | fi
129 | if [ ! -x "$JAVACMD" ] ; then
130 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
131 |
132 | Please set the JAVA_HOME variable in your environment to match the
133 | location of your Java installation."
134 | fi
135 | else
136 | JAVACMD=java
137 | if ! command -v java >/dev/null 2>&1
138 | then
139 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
140 |
141 | Please set the JAVA_HOME variable in your environment to match the
142 | location of your Java installation."
143 | fi
144 | fi
145 |
146 | # Increase the maximum file descriptors if we can.
147 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
148 | case $MAX_FD in #(
149 | max*)
150 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
151 | # shellcheck disable=SC2039,SC3045
152 | MAX_FD=$( ulimit -H -n ) ||
153 | warn "Could not query maximum file descriptor limit"
154 | esac
155 | case $MAX_FD in #(
156 | '' | soft) :;; #(
157 | *)
158 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
159 | # shellcheck disable=SC2039,SC3045
160 | ulimit -n "$MAX_FD" ||
161 | warn "Could not set maximum file descriptor limit to $MAX_FD"
162 | esac
163 | fi
164 |
165 | # Collect all arguments for the java command, stacking in reverse order:
166 | # * args from the command line
167 | # * the main class name
168 | # * -classpath
169 | # * -D...appname settings
170 | # * --module-path (only if needed)
171 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
172 |
173 | # For Cygwin or MSYS, switch paths to Windows format before running java
174 | if "$cygwin" || "$msys" ; then
175 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
176 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
177 |
178 | JAVACMD=$( cygpath --unix "$JAVACMD" )
179 |
180 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
181 | for arg do
182 | if
183 | case $arg in #(
184 | -*) false ;; # don't mess with options #(
185 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
186 | [ -e "$t" ] ;; #(
187 | *) false ;;
188 | esac
189 | then
190 | arg=$( cygpath --path --ignore --mixed "$arg" )
191 | fi
192 | # Roll the args list around exactly as many times as the number of
193 | # args, so each arg winds up back in the position where it started, but
194 | # possibly modified.
195 | #
196 | # NB: a `for` loop captures its iteration list before it begins, so
197 | # changing the positional parameters here affects neither the number of
198 | # iterations, nor the values presented in `arg`.
199 | shift # remove old arg
200 | set -- "$@" "$arg" # push replacement arg
201 | done
202 | fi
203 |
204 |
205 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
206 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
207 |
208 | # Collect all arguments for the java command:
209 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
210 | # and any embedded shellness will be escaped.
211 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
212 | # treated as '${Hostname}' itself on the command line.
213 |
214 | set -- \
215 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
216 | -classpath "$CLASSPATH" \
217 | org.gradle.wrapper.GradleWrapperMain \
218 | "$@"
219 |
220 | # Stop when "xargs" is not available.
221 | if ! command -v xargs >/dev/null 2>&1
222 | then
223 | die "xargs is not available"
224 | fi
225 |
226 | # Use "xargs" to parse quoted args.
227 | #
228 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
229 | #
230 | # In Bash we could simply go:
231 | #
232 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
233 | # set -- "${ARGS[@]}" "$@"
234 | #
235 | # but POSIX shell has neither arrays nor command substitution, so instead we
236 | # post-process each arg (as a line of input to sed) to backslash-escape any
237 | # character that might be a shell metacharacter, then use eval to reverse
238 | # that process (while maintaining the separation between arguments), and wrap
239 | # the whole thing up as a single "set" statement.
240 | #
241 | # This will of course break if any of these variables contains a newline or
242 | # an unmatched quote.
243 | #
244 |
245 | eval "set -- $(
246 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
247 | xargs -n1 |
248 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
249 | tr '\n' ' '
250 | )" '"$@"'
251 |
252 | exec "$JAVACMD" "$@"
253 |
--------------------------------------------------------------------------------
/iosApp/iosApp.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 56;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; };
11 | 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; };
12 | 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; };
13 | 7555FF83242A565900829871 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF82242A565900829871 /* ContentView.swift */; };
14 | /* End PBXBuildFile section */
15 |
16 | /* Begin PBXFileReference section */
17 | 058557BA273AAA24004C7B11 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
18 | 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; };
19 | 2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = ""; };
20 | 7555FF7B242A565900829871 /* EkspenseTrakker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = EkspenseTrakker.app; sourceTree = BUILT_PRODUCTS_DIR; };
21 | 7555FF82242A565900829871 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; };
22 | 7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
23 | AB3632DC29227652001CCB65 /* Config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Config.xcconfig; sourceTree = ""; };
24 | /* End PBXFileReference section */
25 |
26 | /* Begin PBXFrameworksBuildPhase section */
27 | B92378962B6B1156000C7307 /* Frameworks */ = {
28 | isa = PBXFrameworksBuildPhase;
29 | buildActionMask = 2147483647;
30 | files = (
31 | );
32 | runOnlyForDeploymentPostprocessing = 0;
33 | };
34 | /* End PBXFrameworksBuildPhase section */
35 |
36 | /* Begin PBXGroup section */
37 | 058557D7273AAEEB004C7B11 /* Preview Content */ = {
38 | isa = PBXGroup;
39 | children = (
40 | 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */,
41 | );
42 | path = "Preview Content";
43 | sourceTree = "";
44 | };
45 | 42799AB246E5F90AF97AA0EF /* Frameworks */ = {
46 | isa = PBXGroup;
47 | children = (
48 | );
49 | name = Frameworks;
50 | sourceTree = "";
51 | };
52 | 7555FF72242A565900829871 = {
53 | isa = PBXGroup;
54 | children = (
55 | AB1DB47929225F7C00F7AF9C /* Configuration */,
56 | 7555FF7D242A565900829871 /* iosApp */,
57 | 7555FF7C242A565900829871 /* Products */,
58 | 42799AB246E5F90AF97AA0EF /* Frameworks */,
59 | );
60 | sourceTree = "";
61 | };
62 | 7555FF7C242A565900829871 /* Products */ = {
63 | isa = PBXGroup;
64 | children = (
65 | 7555FF7B242A565900829871 /* EkspenseTrakker.app */,
66 | );
67 | name = Products;
68 | sourceTree = "";
69 | };
70 | 7555FF7D242A565900829871 /* iosApp */ = {
71 | isa = PBXGroup;
72 | children = (
73 | 058557BA273AAA24004C7B11 /* Assets.xcassets */,
74 | 7555FF82242A565900829871 /* ContentView.swift */,
75 | 7555FF8C242A565B00829871 /* Info.plist */,
76 | 2152FB032600AC8F00CF470E /* iOSApp.swift */,
77 | 058557D7273AAEEB004C7B11 /* Preview Content */,
78 | );
79 | path = iosApp;
80 | sourceTree = "";
81 | };
82 | AB1DB47929225F7C00F7AF9C /* Configuration */ = {
83 | isa = PBXGroup;
84 | children = (
85 | AB3632DC29227652001CCB65 /* Config.xcconfig */,
86 | );
87 | path = Configuration;
88 | sourceTree = "";
89 | };
90 | /* End PBXGroup section */
91 |
92 | /* Begin PBXNativeTarget section */
93 | 7555FF7A242A565900829871 /* iosApp */ = {
94 | isa = PBXNativeTarget;
95 | buildConfigurationList = 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */;
96 | buildPhases = (
97 | F36B1CEB2AD83DDC00CB74D5 /* Compile Kotlin Framework */,
98 | 7555FF77242A565900829871 /* Sources */,
99 | B92378962B6B1156000C7307 /* Frameworks */,
100 | 7555FF79242A565900829871 /* Resources */,
101 | );
102 | buildRules = (
103 | );
104 | dependencies = (
105 | );
106 | name = iosApp;
107 | packageProductDependencies = (
108 | );
109 | productName = iosApp;
110 | productReference = 7555FF7B242A565900829871 /* EkspenseTrakker.app */;
111 | productType = "com.apple.product-type.application";
112 | };
113 | /* End PBXNativeTarget section */
114 |
115 | /* Begin PBXProject section */
116 | 7555FF73242A565900829871 /* Project object */ = {
117 | isa = PBXProject;
118 | attributes = {
119 | BuildIndependentTargetsInParallel = YES;
120 | LastSwiftUpdateCheck = 1130;
121 | LastUpgradeCheck = 1540;
122 | ORGANIZATIONNAME = orgName;
123 | TargetAttributes = {
124 | 7555FF7A242A565900829871 = {
125 | CreatedOnToolsVersion = 11.3.1;
126 | };
127 | };
128 | };
129 | buildConfigurationList = 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */;
130 | compatibilityVersion = "Xcode 14.0";
131 | developmentRegion = en;
132 | hasScannedForEncodings = 0;
133 | knownRegions = (
134 | en,
135 | Base,
136 | );
137 | mainGroup = 7555FF72242A565900829871;
138 | packageReferences = (
139 | );
140 | productRefGroup = 7555FF7C242A565900829871 /* Products */;
141 | projectDirPath = "";
142 | projectRoot = "";
143 | targets = (
144 | 7555FF7A242A565900829871 /* iosApp */,
145 | );
146 | };
147 | /* End PBXProject section */
148 |
149 | /* Begin PBXResourcesBuildPhase section */
150 | 7555FF79242A565900829871 /* Resources */ = {
151 | isa = PBXResourcesBuildPhase;
152 | buildActionMask = 2147483647;
153 | files = (
154 | 058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */,
155 | 058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */,
156 | );
157 | runOnlyForDeploymentPostprocessing = 0;
158 | };
159 | /* End PBXResourcesBuildPhase section */
160 |
161 | /* Begin PBXShellScriptBuildPhase section */
162 | F36B1CEB2AD83DDC00CB74D5 /* Compile Kotlin Framework */ = {
163 | isa = PBXShellScriptBuildPhase;
164 | buildActionMask = 2147483647;
165 | files = (
166 | );
167 | inputFileListPaths = (
168 | );
169 | inputPaths = (
170 | );
171 | name = "Compile Kotlin Framework";
172 | outputFileListPaths = (
173 | );
174 | outputPaths = (
175 | );
176 | runOnlyForDeploymentPostprocessing = 0;
177 | shellPath = /bin/sh;
178 | shellScript = "if [ \"YES\" = \"$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED\" ]; then\n echo \"Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \\\"YES\\\"\"\n exit 0\nfi\ncd \"$SRCROOT/..\"\n./gradlew :composeApp:embedAndSignAppleFrameworkForXcode\n";
179 | };
180 | /* End PBXShellScriptBuildPhase section */
181 |
182 | /* Begin PBXSourcesBuildPhase section */
183 | 7555FF77242A565900829871 /* Sources */ = {
184 | isa = PBXSourcesBuildPhase;
185 | buildActionMask = 2147483647;
186 | files = (
187 | 2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */,
188 | 7555FF83242A565900829871 /* ContentView.swift in Sources */,
189 | );
190 | runOnlyForDeploymentPostprocessing = 0;
191 | };
192 | /* End PBXSourcesBuildPhase section */
193 |
194 | /* Begin XCBuildConfiguration section */
195 | 7555FFA3242A565B00829871 /* Debug */ = {
196 | isa = XCBuildConfiguration;
197 | baseConfigurationReference = AB3632DC29227652001CCB65 /* Config.xcconfig */;
198 | buildSettings = {
199 | ALWAYS_SEARCH_USER_PATHS = NO;
200 | CLANG_ANALYZER_NONNULL = YES;
201 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
202 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
203 | CLANG_CXX_LIBRARY = "libc++";
204 | CLANG_ENABLE_MODULES = YES;
205 | CLANG_ENABLE_OBJC_ARC = YES;
206 | CLANG_ENABLE_OBJC_WEAK = YES;
207 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
208 | CLANG_WARN_BOOL_CONVERSION = YES;
209 | CLANG_WARN_COMMA = YES;
210 | CLANG_WARN_CONSTANT_CONVERSION = YES;
211 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
212 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
213 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
214 | CLANG_WARN_EMPTY_BODY = YES;
215 | CLANG_WARN_ENUM_CONVERSION = YES;
216 | CLANG_WARN_INFINITE_RECURSION = YES;
217 | CLANG_WARN_INT_CONVERSION = YES;
218 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
219 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
220 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
221 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
222 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
223 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
224 | CLANG_WARN_STRICT_PROTOTYPES = YES;
225 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
226 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
227 | CLANG_WARN_UNREACHABLE_CODE = YES;
228 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
229 | COPY_PHASE_STRIP = NO;
230 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
231 | ENABLE_STRICT_OBJC_MSGSEND = YES;
232 | ENABLE_TESTABILITY = YES;
233 | ENABLE_USER_SCRIPT_SANDBOXING = NO;
234 | GCC_C_LANGUAGE_STANDARD = gnu11;
235 | GCC_DYNAMIC_NO_PIC = NO;
236 | GCC_NO_COMMON_BLOCKS = YES;
237 | GCC_OPTIMIZATION_LEVEL = 0;
238 | GCC_PREPROCESSOR_DEFINITIONS = (
239 | "DEBUG=1",
240 | "$(inherited)",
241 | );
242 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
243 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
244 | GCC_WARN_UNDECLARED_SELECTOR = YES;
245 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
246 | GCC_WARN_UNUSED_FUNCTION = YES;
247 | GCC_WARN_UNUSED_VARIABLE = YES;
248 | IPHONEOS_DEPLOYMENT_TARGET = 15.3;
249 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
250 | MTL_FAST_MATH = YES;
251 | ONLY_ACTIVE_ARCH = YES;
252 | SDKROOT = iphoneos;
253 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
254 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
255 | };
256 | name = Debug;
257 | };
258 | 7555FFA4242A565B00829871 /* Release */ = {
259 | isa = XCBuildConfiguration;
260 | baseConfigurationReference = AB3632DC29227652001CCB65 /* Config.xcconfig */;
261 | buildSettings = {
262 | ALWAYS_SEARCH_USER_PATHS = NO;
263 | CLANG_ANALYZER_NONNULL = YES;
264 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
265 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
266 | CLANG_CXX_LIBRARY = "libc++";
267 | CLANG_ENABLE_MODULES = YES;
268 | CLANG_ENABLE_OBJC_ARC = YES;
269 | CLANG_ENABLE_OBJC_WEAK = YES;
270 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
271 | CLANG_WARN_BOOL_CONVERSION = YES;
272 | CLANG_WARN_COMMA = YES;
273 | CLANG_WARN_CONSTANT_CONVERSION = YES;
274 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
275 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
276 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
277 | CLANG_WARN_EMPTY_BODY = YES;
278 | CLANG_WARN_ENUM_CONVERSION = YES;
279 | CLANG_WARN_INFINITE_RECURSION = YES;
280 | CLANG_WARN_INT_CONVERSION = YES;
281 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
282 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
283 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
284 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
285 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
286 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
287 | CLANG_WARN_STRICT_PROTOTYPES = YES;
288 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
289 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
290 | CLANG_WARN_UNREACHABLE_CODE = YES;
291 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
292 | COPY_PHASE_STRIP = NO;
293 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
294 | ENABLE_NS_ASSERTIONS = NO;
295 | ENABLE_STRICT_OBJC_MSGSEND = YES;
296 | ENABLE_USER_SCRIPT_SANDBOXING = NO;
297 | GCC_C_LANGUAGE_STANDARD = gnu11;
298 | GCC_NO_COMMON_BLOCKS = YES;
299 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
300 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
301 | GCC_WARN_UNDECLARED_SELECTOR = YES;
302 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
303 | GCC_WARN_UNUSED_FUNCTION = YES;
304 | GCC_WARN_UNUSED_VARIABLE = YES;
305 | IPHONEOS_DEPLOYMENT_TARGET = 15.3;
306 | MTL_ENABLE_DEBUG_INFO = NO;
307 | MTL_FAST_MATH = YES;
308 | SDKROOT = iphoneos;
309 | SWIFT_COMPILATION_MODE = wholemodule;
310 | SWIFT_OPTIMIZATION_LEVEL = "-O";
311 | VALIDATE_PRODUCT = YES;
312 | };
313 | name = Release;
314 | };
315 | 7555FFA6242A565B00829871 /* Debug */ = {
316 | isa = XCBuildConfiguration;
317 | buildSettings = {
318 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
319 | CODE_SIGN_IDENTITY = "Apple Development";
320 | CODE_SIGN_STYLE = Automatic;
321 | DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
322 | DEVELOPMENT_TEAM = "${TEAM_ID}";
323 | ENABLE_PREVIEWS = YES;
324 | FRAMEWORK_SEARCH_PATHS = (
325 | "$(inherited)",
326 | "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)\n$(SRCROOT)/../composeApp/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)",
327 | );
328 | INFOPLIST_FILE = iosApp/Info.plist;
329 | IPHONEOS_DEPLOYMENT_TARGET = 15.3;
330 | LD_RUNPATH_SEARCH_PATHS = (
331 | "$(inherited)",
332 | "@executable_path/Frameworks",
333 | );
334 | OTHER_LDFLAGS = (
335 | "$(inherited)",
336 | "-framework",
337 | ComposeApp,
338 | );
339 | PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}";
340 | PRODUCT_NAME = "${APP_NAME}";
341 | PROVISIONING_PROFILE_SPECIFIER = "";
342 | SWIFT_VERSION = 5.0;
343 | TARGETED_DEVICE_FAMILY = "1,2";
344 | };
345 | name = Debug;
346 | };
347 | 7555FFA7242A565B00829871 /* Release */ = {
348 | isa = XCBuildConfiguration;
349 | buildSettings = {
350 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
351 | CODE_SIGN_IDENTITY = "Apple Development";
352 | CODE_SIGN_STYLE = Automatic;
353 | DEVELOPMENT_ASSET_PATHS = "\"iosApp/Preview Content\"";
354 | DEVELOPMENT_TEAM = "${TEAM_ID}";
355 | ENABLE_PREVIEWS = YES;
356 | FRAMEWORK_SEARCH_PATHS = (
357 | "$(inherited)",
358 | "$(SRCROOT)/../shared/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)\n$(SRCROOT)/../composeApp/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)",
359 | );
360 | INFOPLIST_FILE = iosApp/Info.plist;
361 | IPHONEOS_DEPLOYMENT_TARGET = 15.3;
362 | LD_RUNPATH_SEARCH_PATHS = (
363 | "$(inherited)",
364 | "@executable_path/Frameworks",
365 | );
366 | OTHER_LDFLAGS = (
367 | "$(inherited)",
368 | "-framework",
369 | ComposeApp,
370 | );
371 | PRODUCT_BUNDLE_IDENTIFIER = "${BUNDLE_ID}${TEAM_ID}";
372 | PRODUCT_NAME = "${APP_NAME}";
373 | PROVISIONING_PROFILE_SPECIFIER = "";
374 | SWIFT_VERSION = 5.0;
375 | TARGETED_DEVICE_FAMILY = "1,2";
376 | };
377 | name = Release;
378 | };
379 | /* End XCBuildConfiguration section */
380 |
381 | /* Begin XCConfigurationList section */
382 | 7555FF76242A565900829871 /* Build configuration list for PBXProject "iosApp" */ = {
383 | isa = XCConfigurationList;
384 | buildConfigurations = (
385 | 7555FFA3242A565B00829871 /* Debug */,
386 | 7555FFA4242A565B00829871 /* Release */,
387 | );
388 | defaultConfigurationIsVisible = 0;
389 | defaultConfigurationName = Release;
390 | };
391 | 7555FFA5242A565B00829871 /* Build configuration list for PBXNativeTarget "iosApp" */ = {
392 | isa = XCConfigurationList;
393 | buildConfigurations = (
394 | 7555FFA6242A565B00829871 /* Debug */,
395 | 7555FFA7242A565B00829871 /* Release */,
396 | );
397 | defaultConfigurationIsVisible = 0;
398 | defaultConfigurationName = Release;
399 | };
400 | /* End XCConfigurationList section */
401 | };
402 | rootObject = 7555FF73242A565900829871 /* Project object */;
403 | }
--------------------------------------------------------------------------------