:wave: Hello, I'm currently running into an issue ...
# multiplatform
l
👋 Hello, I'm currently running into an issue where I have a simple test KMM project (depending on coroutines, ktor, serialization and decompose/mvikotlin) where things are fine on the Android side but on the iOS side things seem a bit odd. The build job (from the KMM plugin) for iOS seems to be successful for the shared module
Copy code
> Task :shared:compileKotlinIos
> Task :shared:linkDebugFrameworkIos
> Task :shared:syncFramework

BUILD SUCCESSFUL in 35s
3 actionable tasks: 3 executed
But then as soon as it starts building the swift app (unmodified demo app):
Copy code
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target 'iosApp' from project 'iosApp')
It keeps throwing a bunch of
Copy code
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/shared.h"
        ^
/Users/xxx/Prototype/TestBaseApp/shared/build/cocoapods/framework/shared.framework/Headers/shared.h:1337:37: error: expected identifier
- (instancetype)initWithDEBUG:(BOOL)DEBUG APPLICATION_ID:(NSString *)APPLICATION_ID BUILD_TYPE:(NSString *)BUILD_TYPE FLAVOR:(NSString *)FLAVOR VERSION_CODE:(int32_t)VERSION_CODE VERSION_NAME:(NSString *)VERSION_NAME GIT_HASH:(NSString *)GIT_HASH MY_API_BUILD_ID:(NSString *)MY_API_BUILD_ID MY_API_CLIENT_ID:(NSString *)MY_API_CLIENT_ID MY_API_CLIENT_NAME:(NSString *)MY_API_CLIENT_NAME PLATFORM:(NSString *)PLATFORM OS:(NSString *)OS OS_VERSION:(NSString *)OS_VERSION PHONE_BRAND:(NSString *)PHONE_BRAND PHONE_TYPE:(NSString *)PHONE_TYPE __attribute__((swift_name("init(DEBUG:APPLICATION_ID:BUILD_TYPE:FLAVOR:VERSION_CODE:VERSION_NAME:GIT_HASH:MY_API_BUILD_ID:MY_API_CLIENT_ID:MY_API_CLIENT_NAME:PLATFORM:OS:OS_VERSION:PHONE_BRAND:PHONE_TYPE:)"))) __attribute__((objc_designated_initializer));
                                    ^
<command line>:16:15: note: expanded from here
#define DEBUG 1
              ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/shared.h"
        ^
/Users/xxx/Prototype/TestBaseApp/shared/build/cocoapods/framework/shared.framework/Headers/shared.h:1359:27: error: expected member name or ';' after declaration specifiers
@property (readonly) BOOL DEBUG __attribute__((swift_name("DEBUG")));
                          ^
<command line>:16:15: note: expanded from here
#define DEBUG 1
              ^
<module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/shared.h"
and keeps repeating a few times complaining about the things in
Headers/shared.h
and finally ending with:
Copy code
/Users/xxx/Prototype/TestBaseApp/iosApp/iosApp/ContentView.swift:2:8: error: could not build Objective-C module 'shared'
import shared
       ^

** BUILD FAILED **


The following build commands failed:
	CompileSwift normal x86_64 /Users/xxx/Prototype/TestBaseApp/iosApp/iosApp/iOSApp.swift
	CompileSwift normal x86_64 /Users/xxx/Prototype/TestBaseApp/iosApp/iosApp/ContentView.swift
	CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
Any thoughts on if it is some kotlin syntax the compiler doesnt like or how I can make the compiler be a bit more verbose to point out what it is struggling with? (I'm using kotlinVersion 1.5.21 and coroutines 1.5.0-native-mt)
rubber duck 1
Ok well that was dumb. Found the issue:
Copy code
data class AppProperties(
    val DEBUG: Boolean, // <-- That's the culprit. Rename it, and it compiles.
    val APPLICATION_ID: String,
    val BUILD_TYPE: String,
    val FLAVOR: String,
    val VERSION_CODE: Int,
    val VERSION_NAME: String,
    val GIT_HASH: String,
    val MY_API_BUILD_ID: String,
    val MY_API_CLIENT_ID: String,
    val MY_API_CLIENT_NAME: String,
    val PLATFORM: String,
    val OS: String,
    val OS_VERSION: String,
    val PHONE_BRAND: String,
    val PHONE_TYPE: String
)
I can't have a variable named
DEBUG
in my data class or it will just fail to build
😲 1
🎉 1
o
Please do report this kotl.in/issue
👍 1
l