Skip to content

Отразить как получать NSError от ios кода в kotlin #33

@Alex009

Description

@Alex009
private fun createLocalWallet(
            name: String,
            createSwiftWallet: (CPointer<ObjCObjectVar<NSError?>>) -> SwiftWallet
        ): LocalWallet {
            val (result, error) = memScoped {
                val p = alloc<ObjCObjectVar<NSError?>>()
                val result: SwiftWallet? = runCatching {
                    createSwiftWallet(p.ptr)
                }.getOrNull()
                result to p.value
            }

            if (error != null) throw error.toException()
            else return LocalWallet(name, result!!)
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions