Refine iOS demo

This commit is contained in:
WildCat 2022-01-08 21:50:37 +08:00
parent 34abe86862
commit bc4552ab90
4 changed files with 5 additions and 70 deletions

1
hello/.gitignore vendored
View File

@ -15,3 +15,4 @@ Cargo.lock
src/HelloFFI.modulemap
src/Hello.swift
src/HelloFFI.h

View File

@ -16,7 +16,8 @@ assemble-frameworks:
xcframeowrk:
lipo -create target/x86_64-apple-ios/release/HelloFFI.framework/HelloFFI target/aarch64-apple-ios-sim/release/HelloFFI.framework/HelloFFI -output target/aarch64-apple-ios-sim/release/HelloFFI.framework/HelloFFI
xcodebuild -create-xcframework -framework target/aarch64-apple-ios/release/HelloFFI.framework -framework target/aarch64-apple-ios-sim/release/HelloFFI.framework -output target/Todo.xcframework
xcodebuild -create-xcframework -framework target/aarch64-apple-ios/release/HelloFFI.framework -framework target/aarch64-apple-ios-sim/release/HelloFFI.framework -output target/HelloFFI.xcframework
cp-xcframeowrk-source:
cp -r target/Todo.xcframework
cp -r target/HelloFFI.xcframework platforms/HelloAppleDemoApp
cp src/Hello.swift platforms/HelloAppleDemoApp

View File

@ -6,3 +6,4 @@ xcuserdata/
*.xccheckout
HelloFFI.xcframework
Hello.swift

View File

@ -1,68 +0,0 @@
// This file was autogenerated by some hot garbage in the `uniffi` crate.
// Trust me, you don't want to mess with it!
#pragma once
#include <stdbool.h>
#include <stdint.h>
// The following structs are used to implement the lowest level
// of the FFI, and thus useful to multiple uniffied crates.
// We ensure they are declared exactly once, with a header guard, UNIFFI_SHARED_H.
#ifdef UNIFFI_SHARED_H
// We also try to prevent mixing versions of shared uniffi header structs.
// If you add anything to the #else block, you must increment the version suffix in UNIFFI_SHARED_HEADER_V3
#ifndef UNIFFI_SHARED_HEADER_V3
#error Combining helper code from multiple versions of uniffi is not supported
#endif // ndef UNIFFI_SHARED_HEADER_V3
#else
#define UNIFFI_SHARED_H
#define UNIFFI_SHARED_HEADER_V3
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V3 in this file. ⚠️
typedef struct RustBuffer
{
int32_t capacity;
int32_t len;
uint8_t *_Nullable data;
} RustBuffer;
typedef RustBuffer (*ForeignCallback)(uint64_t, int32_t, RustBuffer);
typedef struct ForeignBytes
{
int32_t len;
const uint8_t *_Nullable data;
} ForeignBytes;
// Error definitions
typedef struct RustCallStatus {
int8_t code;
RustBuffer errorBuf;
} RustCallStatus;
// ⚠️ Attention: If you change this #else block (ending in `#endif // def UNIFFI_SHARED_H`) you *must* ⚠️
// ⚠️ increment the version suffix in all instances of UNIFFI_SHARED_HEADER_V3 in this file. ⚠️
#endif // def UNIFFI_SHARED_H
void Hello_941e_say_hello(
RustBuffer name,
RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_Hello_941e_rustbuffer_alloc(
int32_t size,
RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_Hello_941e_rustbuffer_from_bytes(
ForeignBytes bytes,
RustCallStatus *_Nonnull out_status
);
void ffi_Hello_941e_rustbuffer_free(
RustBuffer buf,
RustCallStatus *_Nonnull out_status
);
RustBuffer ffi_Hello_941e_rustbuffer_reserve(
RustBuffer buf,int32_t additional,
RustCallStatus *_Nonnull out_status
);