Skip to content

Commit

Permalink
Merge pull request #13 from skiptools/swiftprojecting
Browse files Browse the repository at this point in the history
Create SwiftProjecting protocol for use by bridging code
  • Loading branch information
aabewhite authored Dec 16, 2024
2 parents 9215fac + 51324b6 commit e783bcb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
23 changes: 23 additions & 0 deletions Sources/SkipLib/BridgeSupport.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright 2024 Skip
//
// This is free software: you can redistribute and/or modify it
// under the terms of the GNU Lesser General Public License 3.0
// as published by the Free Software Foundation https://fsf.org

/// Marker protocol for types that are custom bridged from the Swift side.
///
/// - Seealso: `KotlinConverting`
public protocol SwiftCustomBridged {
}

/// Implemented by the generated Kotlin side of a bridged type to provide its Swift projection.
///
/// We keep this in SkipLib so that the Kotlin output of transpiled bridged modules does not have a
/// dependency on SkipBridge. We can add the SkipBridge dependency only when compiling for bridging.
///
/// - Returns: A closure that returns a Swift projection of this object when invoked.
/// - Warning: This protocol is not designed for general use. It is designed for generated bridge code.
/// - Seealso: `SkipBridgeKt.BridgeSupport`
public protocol SwiftProjecting {
func Swift_projection(options: Int) -> () -> Any
}
4 changes: 0 additions & 4 deletions Sources/SkipLib/Skip/KotlinSupport.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
// as published by the Free Software Foundation https://fsf.org
package skip.lib

/// Marker protocol for types that are custom bridged from the Swift side.
interface SwiftCustomBridged {
}

/// A type that can convert to an underlying Kotlin instance.
interface KotlinConverting<T> {
/// Convert a transpiled Swift instance to its Kotlin equivalent.
Expand Down

0 comments on commit e783bcb

Please sign in to comment.