John O'Reilly
03/25/2025, 5:39 PMYuvaraj
03/27/2025, 3:37 AMDovydas
03/27/2025, 4:02 PMMikolaj
03/28/2025, 9:30 AMAppDelegate
(didFinishLaunchingWithOptions, didReceiveRemoteNotifications) and UNUserNotificationDelegate
on kotlin side as well as in swift but with no luck. 🤔
This is a case of user opening app by tapping notification when app was closed completly (not in background)Patryk Drozd
04/01/2025, 12:17 PMSwiftChachaPoly
on the internet but it's outdated. Here is my error and Gradle File.
Error Message
Exception in thread "main" java.lang.Error: /var/folders/4m/c90drcr50gsghb8p86fnn51r0000gp/T/17669576026474868801.m:1:10: fatal error: 'AppleBridge/AppleBridge-Swift.h' file not found
Failed to generate cinterop for :shared:cinteropAppleBridgeIosArm64: Process 'command '/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java'' finished with non-zero exit value 1
:shared:iosArm64Main: cinterop file: /Users/patrykdrozd/Programing/dms-agent/shared/build/libs/shared-iosArm64Cinterop-AppleBridgeMain-1.0.0.klib does not exist
etc
Gradle File
listOf(
iosArm64(),
iosSimulatorArm64(),
).forEach {
it.binaries.framework {
baseName = "shared"
isStatic = true
binaryOption("bundleId", "shared")
}
val platform = when (it.name) {
"iosArm64" -> "iphoneos"
"iosSimulatorArm64" -> "iphonesimulator"
else -> error("Unsupported target ${it.name}")
}
it.compilations.getByName("main") {
cinterops.create("AppleBridge") {
val interopTask = tasks[interopProcessingTaskName]
interopTask.dependsOn(":AppleBridge:build${platform.replaceFirstChar(Char::titlecase)}")
includeDirs.headerFilterOnly("$rootDir/AppleBridge/build/Release-$platform/include")
}
}
}
AppleBridge.def File
language = Objective-C
package = swift.appleBridge
headers = AppleBridge/AppleBridge-Swift.h
headerFilter = AppleBridge/*
staticLibraries = libAppleBridge.a
libraryPaths.ios_x64 = AppleBridge/build/Release-iphonesimulator
libraryPaths.ios_simulator_arm64 = AppleBridge/build/Release-iphonesimulator
libraryPaths.ios_arm64 = AppleBridge/build/Release-iphoneos
linkerOpts = -L/usr/lib/swift
linkerOpts.ios_x64 = -ios_simulator_version_min 13.0 -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/
linkerOpts.ios_simulator_arm64 = -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/
linkerOpts.ios_arm64 = -iphoneos_version_min 13.0 -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/
Update
I found that my Xcode project doesn't create folder with a header Debug-iphoneos/include/*-Bridging-Header.h
John O'Reilly
04/01/2025, 12:32 PMidevicesyslog
for example but not showing the logs for some reasonMikolaj
04/03/2025, 12:34 PMUndefined symbols for architecture arm64
. Anybody knows how to resolve this? I did not change anything and the build ran fine yesterday 🤔Patryk Drozd
04/07/2025, 2:28 PMPatrick Cavanagh
04/10/2025, 8:27 PMdarkmoon_uk
04/12/2025, 10:40 PMshared
Kotlin symbols are visible and navigable from Xcode ✅
When building for simulator in Xcode, compilation result remains correct, but Kotlin symbols are unresolvable to the Xcode IDE 🙅
Is there some search path or configuration that can be added to enable awareness of symbols from simulator build paths?Patryk Drozd
04/15/2025, 8:58 AMthows
with kotlin.
Swift
@objcMembers public class AESCryptoBridge: NSObject {
public func test() throws {
throw CryptoError.invalidData
}
}
On Kotlin I have access to NSError but I have no idea how to use is. Is there any resource that will explain me how to work with?
AESCryptoBridge().testAndReturnError("I have no idea how to use NSError Pointer here")
I found this code but alloc is deprecated if I am correct
val errorPointer: CPointer<ObjCObjectVar<NSError?>> = alloc<ObjCObjectVar<NSError?>>().ptr
Update: I found the solution 🙂
val error = memScoped {
allocPointerTo<ObjCObjectVar<NSError?>>()
}
AESCryptoBridge().testAndReturnError(error.value)
Dovydas
04/16/2025, 5:17 PMFrançois
04/19/2025, 8:29 AMcd "${SRCROOT}/../shared/build/xcode-frameworks/"
(or any other path to the shared framework
• ln -Fs "${CONFIGURATION}" "Debug"
A Debug directory is mandatory for SOURCE_KIT to work!Dovydas
04/20/2025, 3:28 PMchandilsachin
04/22/2025, 12:19 PMMarc
04/22/2025, 2:33 PMMax
04/22/2025, 6:27 PMMainViewController.kt
class like below.
Afterwards I can access IOSPlatformFile
in Swift code.
fun MainViewController() = ComposeUIViewController { App() }
// so swift code can access this
val platformFile: IOSPlatformFile = IOSPlatformFile("")
Could someone clarify what I’m doing wrong in these cases? Are only classes from the main module visible to Swift by default?Hasan Nagizade
05/02/2025, 6:50 AMGNKumar
05/02/2025, 1:40 PMMikolaj
05/06/2025, 1:40 PMembedAndSign
run faster (besides buy new computer)? I'm not using cocoapods nor SPM, only kotlin (and minimum swift boilerplate) yet full ios build still takes 20-30 minutes (macbook M3 16GB ram)
*embedAndSign takes >50% of that timeFarhazul Mullick
05/07/2025, 9:24 AMkotlin native cocoapods
. I have few questions.
1. Why kotlin native cocoapods plugin automatically creates podspec file upon sync.
2. If i use some cocoapods dependency and like Alamofire. I can define in gradle inside cocoapods block. Upon gradle sync podInstall task is ran by gradle. Then kotlin files of those pods are generated from cocoapods package. This later compiled with the final fat-framework. We can use this framework in any ios app. If so why we need to create a pod file in iosApp and run pod install there as well?abraham
05/09/2025, 2:43 PMswift_name
attributes?François
05/13/2025, 10:37 AMCUR="${SRCROOT}/../shared/build/list_of_files.txt"
OLD="${SRCROOT}/../shared/build/old_list_of_files.txt"
touch $OLD
CHANGES="${SRCROOT}/../shared/build/list_of_changes.txt"
ls -lRT "${SRCROOT}/../shared/src/" > $CUR
diff $OLD $CUR > $CHANGES
if [ ! -s "${CHANGES}" ]; then
echo "No change in shared source"
exit 0
fi
if [ "YES" = "$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED" ]; then
echo "Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \"YES\""
exit 0
fi
cd "$SRCROOT/.."
./gradlew :shared:embedAndSignAppleFrameworkForXcode
# set the current change as old after the build is OK
mv $CUR $OLD
jQrgen
05/16/2025, 11:01 AMF
05/21/2025, 5:29 PMchrisjenx
05/24/2025, 6:23 PMVivek Gupta
05/27/2025, 10:33 AMRaphael TEYSSANDIER
05/29/2025, 10:19 PMpublishAndReleaseToMavenCentral
on github actions. But I get an error for iOS:
> Task :xxx:compileKotlinIosSimulatorArm64
e: file:///Users/runner/work/xxx/xxx/xxx/build/generated/ksp/metadata/commonMain/kotlin/io/dot/lorraine/db/XXXConstructor.kt:5:24 'actual object XXXConstructor : RoomDatabaseConstructor<XXXDB>' has no corresponding expected declaration
e: file:///Users/runner/work/xxx/xxx/xxx/build/generated/ksp/metadata/commonMain/kotlin/io/dot/xxx/db/XXXConstructor.kt:5:24 XXXConstructor: expect and corresponding actual are declared in the same module.
> Task :xxx:compileCommonMainKotlinMetadata FAILED
e: file:///Users/runner/work/xxx/xxx/xxx/build/generated/ksp/metadata/commonMain/kotlin/io/dot/xxx/db/XXXConstructor.kt:6:23 'actual fun initialize(): XXXDB' has no corresponding expected declaration
e: file:///Users/runner/work/xxx/xxx/xx/src/commonMain/kotlin/io/dot/xxx/db/XXXConstructor.kt:6:24 XXXConstructor: expect and corresponding actual are declared in the same module.
Any idea how to fix it ?Muaz KADAN
06/01/2025, 8:26 AMfun StringResource.localized(): String {
return runBlocking { getString(this@localized) }
}
Anant Kumar Gupta
06/07/2025, 4:21 AMCGImage
in Kotlin/Native?
Warning - Cannot access class 'cnames. structs. CGImage' in the expression type. While it may work, this case indicates a configuration mistake and can lead to avoidable compilation errors, so it may be forbidden soon. Check your module classpath for missing or conflicting dependencies.
fun generateVideoThumbnailIOS(
uri: String
): ImageBitmap? = memScoped {
val nsUrl = NSURL.Companion.fileURLWithPath(uri.removePrefix("file://"))
val asset = AVURLAsset.URLAssetWithURL(nsUrl, null)
val generator = AVAssetImageGenerator(asset)
generator.appliesPreferredTrackTransform = true
val requestedTime = CMTimeMake(1, 1).useContents { readValue() }
val actualTime: CMTime = alloc<CMTime>()
val errorPtr = alloc<ObjCObjectVar<NSError?>>()
val cgImage = generator.copyCGImageAtTime(
requestedTime = requestedTime,
actualTime = actualTime.ptr,
error = errorPtr.ptr
) ?: run {
println("Error: ${errorPtr.value?.localizedDescription}")
return@memScoped null
}
val uiImage = UIImage.imageWithCGImage(cgImage)
val nsData = uiImage.pngRepresentation() ?: return@memScoped null
val length = nsData.length.toInt()
val bytePtr = nsData.bytes?.reinterpret<ByteVar>() ?: return@memScoped null
val byteArray = bytePtr.readBytes(length)
val finalThumbnail = Image.makeFromEncoded(byteArray).toComposeImageBitmap()
return@memScoped finalThumbnail
}