Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Swift support #178

Open
wants to merge 86 commits into
base: experimental-record
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
ab46995
Improving examples build configs and documentation.
jferreyra-sc Dec 15, 2023
fb63bbc
reverted to sdk 30.0.2
jferreyra-sc Dec 15, 2023
0e5bd48
Set min deployment target on iOS 11 for the example xcode project
jferreyra-sc Dec 19, 2023
f2143f8
Added npm instructions and examples server instructions.
jferreyra-sc Dec 19, 2023
fd1b314
Use std::expected for outcome when available
jb-gcx Mar 14, 2024
ecffe7e
Merge pull request #166 from jb-gcx/gcx/use-std-expected
li-feng-sc Apr 4, 2024
cde53fd
Merge remote-tracking branch 'origin/main' into experimental-record
li-feng-sc Apr 10, 2024
5e03b11
swift test
li-feng-sc Apr 16, 2024
3f40e5a
Fix compilation for djinni::Future
jb-gcx May 8, 2024
2e8e231
wip example
li-feng-sc May 16, 2024
1d84790
cpp files
li-feng-sc May 16, 2024
ff0c4e8
remove unneeded dep
li-feng-sc May 16, 2024
47e3ddd
Merge pull request #168 from jb-gcx/gcx/fixup-future
li-feng-sc May 17, 2024
2e8e189
optimize parameter copy
li-feng-sc May 17, 2024
3e3a662
refactor
li-feng-sc May 21, 2024
420ccc2
refactor
li-feng-sc May 21, 2024
1135f3a
Make DJFuture results nonnull in objective C
jb-gcx May 21, 2024
2842302
namespace
li-feng-sc May 22, 2024
5d95c1b
implement proxy caches
li-feng-sc May 24, 2024
8552689
initial codegen
li-feng-sc Jun 4, 2024
cf0fb53
+nc
li-feng-sc Jun 4, 2024
9972b74
wip
li-feng-sc Jun 14, 2024
9a74ee9
Merge pull request #170 from jb-gcx/gcx/nonnull-future
li-feng-sc Jun 26, 2024
36c027e
Use official C++ 20 coroutine feature test macro
jb-gcx Jul 8, 2024
ea62a3b
all swift tests passing
li-feng-sc Jul 11, 2024
bcf8b1c
comments
li-feng-sc Jul 12, 2024
f98a415
skip label for first parameter
li-feng-sc Jul 12, 2024
6f52b82
Fix extern type usage with non-nullable ptrs
trblunt Jul 14, 2024
5858e64
delete test code
li-feng-sc Jul 15, 2024
7b6cfc3
Merge pull request #179 from trblunt/fix-extern-nn-ptrs
li-feng-sc Jul 15, 2024
cc8190a
Merge pull request #155 from jferreyra-sc/main
li-feng-sc Jul 15, 2024
f603002
Allow move-only types in Promise<>. (based on contribution from jb-gcx)
li-feng-sc Jul 15, 2024
4b57d4a
Merge pull request #176 from jb-gcx/gcx/coroutine-feature-test
li-feng-sc Jul 15, 2024
bd74aaa
Merge remote-tracking branch 'origin/main' into lf/swift-support
li-feng-sc Jul 15, 2024
fe7e06e
Make `unexpect` available for djinni expected
jb-gcx Jul 8, 2024
00878de
delete unneeded overload
li-feng-sc Jul 16, 2024
5466945
Merge pull request #180 from Snapchat/lf/move-only-promise
li-feng-sc Jul 16, 2024
fb12c73
Fix continuations in djinni::Future coroutines
jb-gcx Jul 8, 2024
ee2bcb1
Add an XCTest for coroutine cleanup order
jb-gcx Jul 16, 2024
c6c9f07
Fix feature detection for experimental coroutines
jb-gcx Jul 18, 2024
a97afc7
Merge pull request #181 from jb-gcx/gcx/fix-coroutine-continuation
li-feng-sc Jul 18, 2024
ae855ee
add SharedFuture
techleeksnap Jul 19, 2024
74c6a57
Update support-lib/cpp/SharedFuture.hpp
techleeksnap Jul 19, 2024
74cedd6
cleanup
li-feng-sc Jul 22, 2024
513a6be
add support for deriving(hashable, sendable, codable)
li-feng-sc Jul 23, 2024
ffe02b8
add error conformance
li-feng-sc Jul 23, 2024
14d5aa3
refactor
li-feng-sc Jul 23, 2024
ba173f7
Implement swift future
LoganShireSnapchat Jul 24, 2024
25898a5
Merge pull request #185 from LoganShireSnapchat/lshire-swift-future
li-feng-sc Jul 24, 2024
2f0334a
comment
li-feng-sc Jul 24, 2024
9d1a289
fix warning
li-feng-sc Jul 24, 2024
edada37
address comments
techleeksnap Jul 24, 2024
c7cbf0a
use atomic int64 instead of uuid as subscription token
li-feng-sc Jul 24, 2024
1a4080d
fix
techleeksnap Jul 24, 2024
bf60220
address comments
techleeksnap Jul 24, 2024
987cd72
address comments
techleeksnap Jul 24, 2024
823a8eb
add header
li-feng-sc Jul 26, 2024
7494022
Merge branch 'main' into lf/swift-support
li-feng-sc Jul 26, 2024
954a8a9
move-only optionals
li-feng-sc Jul 26, 2024
d29731e
touch
li-feng-sc Jul 26, 2024
8e404d8
test
li-feng-sc Jul 26, 2024
e1a08ff
uncomment
li-feng-sc Jul 26, 2024
0c74a2a
touch
li-feng-sc Jul 26, 2024
c0b131e
try again
li-feng-sc Jul 26, 2024
d3ab313
try again
li-feng-sc Jul 26, 2024
c08793d
comment
li-feng-sc Jul 26, 2024
683c39f
touch
li-feng-sc Jul 26, 2024
ce6add1
Update support-lib/cpp/Future.hpp
techleeksnap Jul 26, 2024
c271198
add prefix dirs
li-feng-sc Jul 31, 2024
b604359
Merge pull request #183 from techleeksnap/sharedfuture
li-feng-sc Aug 1, 2024
6c30c31
Merge remote-tracking branch 'origin/main' into lf/swift-support
li-feng-sc Aug 1, 2024
17458b9
Small error in README.md
ysammy Aug 1, 2024
252271d
fixes as per review comments
li-feng-sc Aug 7, 2024
dc8b666
Finish futures when their promise is broken
jb-gcx Aug 12, 2024
a237529
downgrade swift protobuf to 1.26
li-feng-sc Aug 13, 2024
2383dc1
Merge pull request #186 from ysammy/patch-1
li-feng-sc Aug 14, 2024
971228b
Merge pull request #187 from jb-gcx/gcx/broken-promises
li-feng-sc Aug 14, 2024
9c687a2
Merge branch 'main' into lf/swift-support
li-feng-sc Aug 15, 2024
eedf683
fixes
li-feng-sc Aug 15, 2024
6e986dd
fixes for snap client integration
li-feng-sc Aug 29, 2024
539df09
fixes
li-feng-sc Aug 29, 2024
be7eff9
revert the nonnull future get change because it prevents future<optio…
li-feng-sc Aug 30, 2024
dd172fe
Remove -fcoroutines-ts
ivan-golub Sep 26, 2024
3d3c46b
Remove -fcoroutines-ts from host_cxxopt too
ivan-golub Sep 26, 2024
3fe25d8
Merge pull request #189 from ivan-golub/patch-1
li-feng-sc Sep 26, 2024
82ba611
avoid swift keywords
li-feng-sc Oct 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ to build and run Objective-C and Java tests.

### Building and running the mobile example apps

The Android example app can be build with bazel: `bazel build
//examples:android-app`, and then install to a device with `adb install
bazel-bin/examples/android-app.apk`
You need to install the Android SDK 30.0.2 and the NDK 21.4.7075529. You need both `ANDROID_SDK_HOME` and `ANDROID_NDK_HOME` env variables set.
The Android example app can be build with bazel: `bazel build //examples:android-app`,
and then install to a device with `adb install bazel-bin/examples/android-app.apk`

The iOS example app are built with Xcode. Simply open the project in Xcode and
it should work.
Expand Down Expand Up @@ -65,7 +65,7 @@ verify the build and binary from the command line.
- Protobuf type support
- Local flags with `@flag` directive
- DataView for copy free data passing
- DateRef for copy free data passing with ownership
- DataRef for copy free data passing with ownership
- Generating string names for C++ enums
- Omit optional parameters from record constructors
- Records are default mutable across all platforms
Expand Down Expand Up @@ -141,7 +141,8 @@ outcome<RESULT, ERROR>
Where RESULT and ERROR can be any Djinni types (primitives or records).


In C++, the `outcome<>` type maps to the template class `djinni::expected<>`.
In C++, the `outcome<>` type maps to the template `djinni::expected<>`,
which is an alias of `std::expected<>` if supported or a drop-in replacement otherwise.
In Java, it maps to the generic class `com.snapchat.djinni.Outcome<>`. In ObjC,
it maps to the generic class `DJOutcome<>`.

Expand Down Expand Up @@ -303,9 +304,11 @@ Notable differences when comparing to the Java/ObjC support:
easily add extension methods (by add functions to prototype) without having to
derive from a base class.

The command to run Wasm/TypeScript unit tests is `bazel run
//test-suite:server-ts`. You will need the `tsc` compiler and the `browserify`
tool to run these tests.
Use `bazel run //test-suite:server-ts` to run the Wasm/TypeScript unit tests.
You will need `npm` and run `npm install` in the `test-suite` folder.
You need as well the `tsc` compiler and the `browserify` tool to run these tests.

To run the examples server: `bazel run //examples:server`

## Async interface support

Expand Down
27 changes: 13 additions & 14 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,25 @@ android_workspace()

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

build_bazel_rules_apple_version = "1.0.1"
build_bazel_rules_apple_version = "1.1.3"
http_archive(
name = "build_bazel_rules_apple",
sha256 = "36072d4f3614d309d6a703da0dfe48684ec4c65a89611aeb9590b45af7a3e592",
url = "https://github.com/bazelbuild/rules_apple/releases/download/{0}/rules_apple.{0}.tar.gz"
.format(build_bazel_rules_apple_version),
sha256 = "f94e6dddf74739ef5cb30f000e13a2a613f6ebfa5e63588305a71fce8a8a9911",
url = "https://github.com/bazelbuild/rules_apple/releases/download/{0}/rules_apple.{0}.tar.gz" .format(build_bazel_rules_apple_version),
)

build_bazel_rules_swift_version = "1.0.0"
build_bazel_rules_swift_version = "1.14.0"
http_archive(
name = "build_bazel_rules_swift",
sha256 = "12057b7aa904467284eee640de5e33853e51d8e31aae50b3fb25d2823d51c6b8",
url = "https://github.com/bazelbuild/rules_swift/releases/download/{0}/rules_swift.{0}.tar.gz"
.format(build_bazel_rules_swift_version),
sha256 = "9b0064197e3b6c123cf7cbd377ad5071ac020cbd208fcc23dbc9f3928baf4fa2",
url = "https://github.com/bazelbuild/rules_swift/releases/download/{0}/rules_swift.{0}.tar.gz" .format(build_bazel_rules_swift_version),
)

build_bazel_apple_support_version = "1.0.0"
build_bazel_apple_support_version = "1.15.1"
http_archive(
name = "build_bazel_apple_support",
sha256 = "df317473b5894dd8eb432240d209271ebc83c76bb30c55481374b36ddf1e4fd1",
url = "https://github.com/bazelbuild/apple_support/releases/download/{0}/apple_support.{0}.tar.gz"
.format(build_bazel_apple_support_version),
sha256 = "c4bb2b7367c484382300aee75be598b92f847896fb31bbd22f3a2346adf66a80",
url = "https://github.com/bazelbuild/apple_support/releases/download/{0}/apple_support.{0}.tar.gz" .format(build_bazel_apple_support_version),
)

rules_kotlin_version = "legacy-1.3.0"
Expand All @@ -50,13 +47,15 @@ http_archive(
)

load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies")
load("@build_bazel_rules_swift//swift:repositories.bzl", "swift_rules_dependencies")
load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies")
load("@build_bazel_rules_swift//swift:repositories.bzl", "swift_rules_dependencies")
load("@build_bazel_rules_swift//swift:extras.bzl", "swift_rules_extra_dependencies",)
load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kotlin_repositories", "kt_register_toolchains")

apple_rules_dependencies()
swift_rules_dependencies()
apple_support_dependencies()
swift_rules_dependencies()
swift_rules_extra_dependencies()

kotlin_repositories()
kt_register_toolchains()
Expand Down
15 changes: 15 additions & 0 deletions bzl/deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,18 @@ def djinni_deps():
url = "https://github.com/bazelbuild/rules_jvm_external/archive/{}.zip".format(rules_jvm_external_tag),
sha256 = "62133c125bf4109dfd9d2af64830208356ce4ef8b165a6ef15bbff7460b35c3a",
)
swiftprotobuf_version = "1.26.0"
maybe(
name = "apple_swift_protobuf",
repo_rule = http_archive,
url = "https://github.com/apple/swift-protobuf/archive/refs/tags/{}.tar.gz".format(swiftprotobuf_version),
strip_prefix = "swift-protobuf-{}".format(swiftprotobuf_version),
sha256 = "25224376205a54bb719fe7d97aeb9d8f5219c7ef668f426a5dab2da7db992842",
build_file_content = """
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
swift_library(
name = "swift-protobuf",
module_name = "SwiftProtobuf",
srcs = glob(["Sources/SwiftProtobuf/**/*.swift"]),
visibility = ["//visibility:public"],
)""")
59 changes: 58 additions & 1 deletion examples/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application")
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
load("@emsdk//emscripten_toolchain:wasm_rules.bzl", "wasm_cc_binary")
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")

cc_library(
name = "textsort-common",
Expand All @@ -20,6 +21,7 @@ cc_library(
"//support-lib:djinni-support-common",
],
alwayslink = 1,
visibility = ["//visibility:public"],
)

# ------------------------------------------------------------------
Expand Down Expand Up @@ -53,7 +55,7 @@ android_library(
srcs = glob(["handwritten-src/java/com/dropbox/textsort/*.java"]),
custom_package = "com.dropbox.textsort",
manifest = "android/app/src/main/AndroidManifest.xml",
resource_files = glob(["android/app/src/main/res/**"]),
resource_files = glob(["android/app/src/main/res/**"], exclude=["android/app/src/main/res/.DS_Store"]),
deps = [":textsort-java",],
)

Expand Down Expand Up @@ -99,3 +101,58 @@ sh_binary(
srcs = ["ts/run.sh"],
data = glob(["ts/*.html", "ts/*.ts", "ts/*.json", "generated-src/ts/*.ts"]) + [":wasm"]
)

# ------------------------------------------------------------------

swift_private_files = "generated-src/swift/*+Private.swift"

swift_library(
name = "textsort-swift",
module_name = "TextSort",
srcs = glob([
"generated-src/swift/*.swift",
], exclude = [ swift_private_files ]),
copts = ["-cxx-interoperability-mode=default", "-Xcc", "-std=c++17",],
deps = [
"//support-lib:djinni-support-swift",
],
visibility = ["//visibility:public"],
)

swift_library(
name = "textsort-swift-bridge",
module_name = "TextSortBridge",
srcs = glob([swift_private_files,]),
copts = ["-cxx-interoperability-mode=default", "-Xcc", "-std=c++17",],
deps = [
":textsort-common",
":textsort-swift",
":textsort-swiftxx",
"//support-lib:djinni-support-swift",
"//support-lib:djinni-support-swiftxx",
],
visibility = ["//visibility:public"],
)

cc_library(
name = "textsort-swiftxx",
srcs = glob([
"generated-src/swiftxx/*.cpp",
]),
hdrs = glob([
"generated-src/swiftxx/*.hpp",
]),
includes = [
"generated-src/swiftxx",
".",
],
deps = [
":textsort-common",
":textsort-swift",
"//support-lib:djinni-support-common",
"//support-lib:djinni-support-swiftxx",
],
copts = ["-std=c++17",],
tags = ["swift_module=TextSortCxx"],
visibility = ["//visibility:public"],
)
2 changes: 1 addition & 1 deletion examples/example.djinni
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ sort_items = interface +c {
static run_sort(items: item_list): item_list;
}

textbox_listener = interface +j +o +w {
textbox_listener = interface +nc {
update(items: item_list);
}
23 changes: 23 additions & 0 deletions examples/generated-src/swift/ItemList+Private.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file was generated by Djinni from example.djinni

import DjinniSupport
import DjinniSupportCxx
import Foundation
import TextSort
import TextSortCxx

public enum ItemListMarshaller: DjinniSupport.Marshaller {
public typealias SwiftType = TextSort.ItemList
public static func fromCpp(_ c: djinni.swift.AnyValue) -> SwiftType {
return withUnsafePointer(to: c) { p in
let items = ListMarshaller<StringMarshaller>.fromCpp(djinni.swift.getMember(p, 0))
return SwiftType(items: items)
}
}
public static func toCpp(_ s: SwiftType) -> djinni.swift.AnyValue {
var ret = djinni.swift.makeCompositeValue()
djinni.swift.addMember(&ret, ListMarshaller<StringMarshaller>.toCpp(s.items))
return ret
}
}
13 changes: 13 additions & 0 deletions examples/generated-src/swift/ItemList.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file was generated by Djinni from example.djinni

import Foundation

public struct ItemList {
public var items: Array<String>

public init(items: Array<String>)
{
self.items = items
}
}
45 changes: 45 additions & 0 deletions examples/generated-src/swift/SortItems+Private.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file was generated by Djinni from example.djinni

import DjinniSupport
import DjinniSupportCxx
import Foundation
import TextSort
import TextSortCxx

final class SortItemsCppProxy: DjinniSupport.CppProxy, TextSort.SortItems {
init(_ inst: djinni.swift.AnyValue) { super.init(inst:inst) }
func sort(_ order: TextSort.SortOrder, items: TextSort.ItemList) throws -> Void {
var _params = djinni.swift.ParameterList()
_params.addValue(inst)
_params.addValue(SortOrderMarshaller.toCpp(order))
_params.addValue(ItemListMarshaller.toCpp(items))
var ret = djinni_generated.SortItems_sort(&_params)
try handleCppErrors(&ret)
}
}
public enum SortItemsMarshaller: DjinniSupport.Marshaller {
public typealias SwiftType = TextSort.SortItems
public static func fromCpp(_ c: djinni.swift.AnyValue) -> SwiftType {
return cppInterfaceToSwift(c, { SortItemsCppProxy(c) as SwiftType })
}
public static func toCpp(_ s: SwiftType) -> djinni.swift.AnyValue {
return swiftInterfaceToCpp(s, { fatalError("n/a") })
}
}
public class SortItems_statics {
public static func createWithListener(_ listener: TextSort.TextboxListener) throws -> TextSort.SortItems {
var _params = djinni.swift.ParameterList()
_params.addValue(TextboxListenerMarshaller.toCpp(listener))
var ret = djinni_generated.SortItems_createWithListener(&_params)
try handleCppErrors(&ret)
return SortItemsMarshaller.fromCpp(ret)
}
public static func runSort(_ items: TextSort.ItemList) throws -> TextSort.ItemList {
var _params = djinni.swift.ParameterList()
_params.addValue(ItemListMarshaller.toCpp(items))
var ret = djinni_generated.SortItems_runSort(&_params)
try handleCppErrors(&ret)
return ItemListMarshaller.fromCpp(ret)
}
}
9 changes: 9 additions & 0 deletions examples/generated-src/swift/SortItems.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file was generated by Djinni from example.djinni

import Foundation

public protocol SortItems: AnyObject {
/** For the iOS / Android demo */
func sort(_ order: TextSort.SortOrder, items: TextSort.ItemList) throws -> Void
}
7 changes: 7 additions & 0 deletions examples/generated-src/swift/SortOrder+Private.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file was generated by Djinni from example.djinni

import DjinniSupport
import TextSort

public typealias SortOrderMarshaller = DjinniSupport.EnumMarshaller<SortOrder>
8 changes: 8 additions & 0 deletions examples/generated-src/swift/SortOrder.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file was generated by Djinni from example.djinni

public enum SortOrder: Int32 {
case ascending = 0
case descending = 1
case random = 2
}
25 changes: 25 additions & 0 deletions examples/generated-src/swift/TextboxListener+Private.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file was generated by Djinni from example.djinni

import DjinniSupport
import DjinniSupportCxx
import Foundation
import TextSort
import TextSortCxx

let textboxListenerMethods: Vtbl<TextboxListener> = [
{ inst, params, ret in
let _items = ItemListMarshaller.fromCpp(djinni.swift.getMember(params, 0))
try inst.update(_items)
},
]

public enum TextboxListenerMarshaller: DjinniSupport.Marshaller {
public typealias SwiftType = TextSort.TextboxListener
public static func fromCpp(_ c: djinni.swift.AnyValue) -> SwiftType {
return cppInterfaceToSwift(c, { fatalError("n/a") })
}
public static func toCpp(_ s: SwiftType) -> djinni.swift.AnyValue {
return swiftInterfaceToCpp(s, { djinni_generated.TextboxListenerSwiftProxy.make(ctxPtr(s, textboxListenerMethods), dispatcherProtocalCall)})
}
}
8 changes: 8 additions & 0 deletions examples/generated-src/swift/TextboxListener.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file was generated by Djinni from example.djinni

import Foundation

public protocol TextboxListener: AnyObject {
func update(_ items: TextSort.ItemList) throws -> Void
}
18 changes: 18 additions & 0 deletions examples/generated-src/swiftxx/SwiftItemList.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file was generated by Djinni from example.djinni

#include "SwiftItemList.hpp" // my header

namespace djinni_generated {

djinni::swift::AnyValue SwiftItemList::fromCpp(const ::textsort::ItemList& c) {
auto ret = std::make_shared<djinni::swift::CompositeValue>();
ret->addValue(::djinni::swift::List<::djinni::swift::String>::fromCpp(c.items));
return {ret};
}
::textsort::ItemList SwiftItemList::toCpp(const djinni::swift::AnyValue& s) {
auto p = std::get<djinni::swift::CompositeValuePtr>(s);
return ::textsort::ItemList(::djinni::swift::List<::djinni::swift::String>::toCpp(p->getValue(0)));
}

} // namespace djinni_generated
17 changes: 17 additions & 0 deletions examples/generated-src/swiftxx/SwiftItemList.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// AUTOGENERATED FILE - DO NOT MODIFY!
// This file was generated by Djinni from example.djinni

#pragma once

#include "djinni_support.hpp"
#include "item_list.hpp"

namespace djinni_generated {

struct SwiftItemList {
using CppType = ::textsort::ItemList;
static djinni::swift::AnyValue fromCpp(const CppType& c);
static CppType toCpp(const djinni::swift::AnyValue& s);
};

} // namespace djinni_generated
Loading
Loading