-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add first party Objective-C to Swift SDK RPC migration shim. (#350)
- Loading branch information
1 parent
40bd164
commit f33f7c2
Showing
11 changed files
with
823 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,6 +151,9 @@ | |
'id', | ||
'delete', | ||
'hash', | ||
'boolvalue', | ||
'floatvalue', | ||
'intvalue', | ||
} | ||
|
||
_reserved_prefixes = { | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/// | ||
/// Copyright (c) 2024 Dropbox, Inc. All rights reserved. | ||
/// | ||
/// Auto-generated by Stone, do not modify. | ||
/// | ||
|
||
import Foundation | ||
import stone_sdk_objc | ||
import stone_sdk_swift | ||
import stone_sdk_swift_objc | ||
|
||
{% for data_type in namespace.linearize_data_types() %} | ||
{% set dbx_data_type_class_name = fmt_objc_type(data_type) %} | ||
{% set db_data_type_class_name = fmt_class_prefix(data_type) %} | ||
func map{{ db_data_type_class_name }}ToDBXOptional(object: {{ db_data_type_class_name}}?) -> {{ dbx_data_type_class_name }}? { | ||
guard let object = object else { return nil } | ||
return map{{ db_data_type_class_name }}ToDBX(object: object) | ||
} | ||
|
||
func map{{ db_data_type_class_name }}ToDBX(object: {{ db_data_type_class_name}}) -> {{ dbx_data_type_class_name }} { | ||
{% if is_struct_type(data_type) %} | ||
{% if datatype_subtype_value_types(data_type)|length > 0 %} | ||
switch object { | ||
{% for type in datatype_subtype_value_types(data_type) %} | ||
case let object as {{ fmt_class_prefix(type) }}: | ||
return {{ fmt_objc_type(type) }}({{ shim_legacy_objc_init_args_to_objc(type, 'object') }}) | ||
{% endfor %} | ||
default: | ||
return {{ dbx_data_type_class_name }}({{ shim_legacy_objc_init_args_to_objc(data_type, 'object') }}) | ||
} | ||
{% else %} | ||
return {{ dbx_data_type_class_name }}({{ shim_legacy_objc_init_args_to_objc(data_type, 'object') }}) | ||
{% endif %} | ||
{% elif is_union_type(data_type) %} | ||
{% for field in data_type.all_fields %} | ||
{% set case_class = dbx_data_type_class_name + fmt_class(field.name) %} | ||
{% set case_var_name = fmt_var(field.name) %} | ||
if object.{{ fmt_legacy_objc_union_case_check(field.name, data_type) }}() { | ||
{% if not is_void_type(field.data_type) %} | ||
let {{ case_var_name }} = {{ shim_legacy_objc_union_associated_type(field, data_type) }} | ||
return {{ dbx_data_type_class_name }}.factory(swift: {{ shim_legacy_objc_union_associated_type_init(field) }}) | ||
{% else %} | ||
return {{ case_class }}() | ||
{% endif %} | ||
} | ||
{% endfor %} | ||
fatalError("codegen error") | ||
{% endif %} | ||
} | ||
|
||
{% endfor %} |
Oops, something went wrong.