Skip to content

Latest commit

 

History

History
80 lines (56 loc) · 2.45 KB

README.md

File metadata and controls

80 lines (56 loc) · 2.45 KB

Get Started

Setup

  • Build Kotlin Multiplatform Mobile XCFramework for iOS
./scripts/build_kmm_framework.sh Debug

Open project with Xcode

 open DroidKaigi2022/DroidKaigi2022.xcodeproj

Building prerequisite

  • As we run gradle task as a part of building, Xcode needs to know location of your java home. Usually you should be able to find out about this by typing the following command:
echo $JAVA_HOME

If your java home is not found, you need to install it as it is a required for building this iOS app for DroidKaigi.

  • Setup your Java home location found above in the file called local.properties. Usually, this file is created automatically once you successfully loaded project with Android Studio. If you don't find this file, you can create this file manually at the root of the project.

  • Add content of your JAVA_HOME into the file with the key org.gradle.java.home=<YOUR_JAVA_HOME_PATH>

Requirements

  • Xcode 14.0 or Later

Source Code

Architecture

The Composable Architecture

Project Structure

Feature based module definition.

Development Tools

Development tools are introduced by Swift Package Manager Plugin.

In this project, these packages are local plugin (Local defined plugin) and the why of using local plugin is performance issue of Xcode. When using remote package plugin, Xcode CPU usage becomes so high (over 100%).

Code sample

import PackagePlugin

@main
struct SwiftLintPlugins: BuildToolPlugin {
    func createBuildCommands(context: PluginContext, target: Target) async throws -> [Command] {
        return [
            .buildCommand(
                displayName: "Linting \(target.name)",
                executable: try context.tool(named: "swiftlint").path,
                arguments: [
                    "lint",
                    "--in-process-sourcekit", // alternative to the environment variable
                    target.directory.string   // only lint the files in the target directory
                ],
                environment: [:]
            )
        ]
    }
}

Workaround

Xcode Previews

Before preview resume, specifying "Target" that a preview target view is belonged is needed.

For example, when preview "AboutView", specify "AboutFeature".