Commit Graph
40 Commits
Author SHA1 Message Date
Marc RousavyandGitHub baed798c3e feat: Create React Native ViewManager (+ Props + State) for HybridViews (#500) 2025-01-20 16:40:15 +01:00
Marc RousavyandGitHub bbbeeaf6b8 feat: Specify RN version as compiler flag (#490)
* feat: Specify RN version in iOS

* Set RN version

* docs

* fix: Adjust scripts and add bootstrap

* fix: Fix react-native path again

* feat: Add `REACT_NATIVE_VERSION` flag to gradle

* fix: Use `tasks.register` to avoid reconfiguration

* fix: Use `project.layout.buildDirectory` instead of `project.buildDir`

* fix: arguments with comma

* fix: Use `buildDir` again

* fix: Pass `YES`

* feat: Add CMake C++ flags now

* fix: Indicate default overridden `HybridObject` constructor

* perf: Make `equals()` a bit faster
2025-01-13 14:13:00 +01:00
Marc RousavyandGitHub 00e9db4087 perf: Create PromiseHolder<T> (#439)
* feat: Create `PromiseHolder<T>`

* fix: Fix PromiseHolder

* partial fix

* It works now

* fix: Make `_mutex` a value

* Move ctor

* perf: Move functions

* Add back deprecated func

* more explicit
2024-12-20 11:12:08 +01:00
Marc RousavyandGitHub 5b3fa6c1d0 feat: Implement Swift errors 🥳 (#430)
* chore: Use C++ 23

* feat: Add `ResultWrappingType`

* feat: Add C++ `ResultWrappingType` bridge

* feat: Use C++ result wrapper

* feat: Use `std::expected` for Swift return types

* Bump to 23

* Downgrade to C++ 20 again

* fix: Use `Result<T>` instead of expected

* fix: Return even if void

* fix: Explicitly say type

* extra line for debugging

* fix: Fix double args

* fix: Bridge directly to C++ target for return values

* feat: THROW SWIFT ERROR WOOHOOO

* feat: Make it work

* feat: Add test that uses `Result<complex type>` and throws before

* Update getTests.ts

* Update HybridTestObjectKotlin.kt

* extra line

* perf: Use `assert` for `value()`

* docs: Remove error swift limitation as it now works
2024-12-18 16:51:54 +01:00
Marc RousavyandGitHub 0d7323d396 fix: Fix build when using use_frameworks (#379)
* fix: Fix build when using `use_frameworks`

* Update Podfile.lock

* fix: Declare dependency on `React-jsi` and `React-callinvoker`

* fix: Add `folly_compiler_flags`

* fix: Add `GCC_PREPROCESSOR_DEFINITIONS` again because we need to disable folly config

* fix: Remove unused compiler_flags

* Update Podfile.lock
2024-12-02 13:47:18 +01:00
Krzysztof MochandGitHub 36cf8ee72c feat: Add macOS and tvOS support (#372) 2024-11-25 14:31:42 +01:00
Marc RousavyandGitHub 6da4f98904 feat: Support awaiting JS Promise in Kotlin and Swift (#355)
* feat: Support passing `Promise` to Kotlin

* feat: Add `onResolvedListener`

* feat: Add `.then`, `.catch` and `.await` to Promise!

* feat: Use `await`

* feat: Use `Throwable` instead of `String` for error on Android

* Update Promise.kt

* chore: Remove unused `reject(string)` function now

* Update Promise.hpp

* Update Promise.hpp

* feat: Implement `awaitPromise(..)` on iOS

* feat: Add `RuntimeError` and `.toCpp` to Swift

* fix: Fix duplicate symbol in `RuntimeError`

* feat: Add `ErrorType`

* feat: Add `const&` funcs to `Promise` for Swift

* feat: Add `dependencies` to SwiftCxxBridge

* fix: `error` type

* feat: Add `RuntimeError.from(std.exception)`

* feat: Add `getFunctionCopy()` to `SwiftClosure`

* fix: Account for `Promise<void>` resolver

* fix: Fix `UnsafeMutableRawPointer` being nullable (wrong type)

* nitrogen

* clean

* Update HybridTestObjectSwiftKotlinSpecCxx.swift

* feat: Add actual Promise listeners!!

* fix: Add `addOnResolvedListenerCopy` func for some cases

* chore: Format

* fix: Make `getFunctionCopy()` const

* feat: Support `Promise<void>` from JS!

* feat: Add `awaitAndGet` and `awaitAndGetComplex` promise tests

* feat: Test both new functions

* Slap a good ol' `mutex` on `Promise`

* fix: Fix `Promise<void>` never resolving because args count was `1` (`undefined`)

* fix: Fix Android wrong return type

* Update HybridTestObjectCpp.cpp
2024-11-19 18:06:31 +01:00
Marc RousavyandGitHub 110dcbf29d feat: Use new, faster, simpler Promise<T> in Nitrogen (#349)
* fix: Add `Promise.hpp` to podspec

* feat: Use new `Promise<T>` type for C++ and Swift

just a minor bug left

* chore: Format

* fix: Fix nitrogen to use old `future` for function return types FOR NOW

* feat: Use new `Promise<T>` on Kotlin!

* chore: Remove unused `PromiseHolder` now

* chore: Format
2024-11-19 02:21:21 +01:00
Krzysztof MochandGitHub 328a6e1251 feat: Add visionOS support (#323)
* feat: Add visionOS support

* chore: Update package.json keywords
2024-11-12 17:04:16 +01:00
Marc RousavyandGitHub aae46cb8c5 chore: Adjust Pod/Gradle message (#288)
* chore: Rename Pod/Gradle message

* chore: Put flame infront
2024-11-05 20:43:36 +01:00
Marc RousavyandGitHub b9bfb24e2e fix: Enable DEFINES_MODULE for stricter modular headers (#235)
* fix: Enable `DEFINES_MODULE` for stricter modular headers

* fix: Also set `DEFINES_MODULE` for all generated specs

e.g. NitroImage
2024-10-16 11:28:24 +02:00
Marc RousavyandGitHub dc8f8668f4 feat: Make Nitro itself a Nitro Module and add old-architecture support 🔥 (#175)
* feat: Create `HybridNitroModulesProxy`

* feat: Create `InstallNitro`

* docs: Create `entry-point.md` docs

* fix: Create `JSIConverter<HostObject>` (for BoxedHybridObject)

* Update NitroModulesProxy.ts

* feat: Refactor JS for new module

* feat: Refactor JS again

* feat: Create iOS TurboModule that installs Nitro

* feat: Implement `install()` for old arch (iOS)

* chore: Format

* feat: Implement TurboModule `install()` on Android

* fix: Use `CallInvokerHolderImpl`

* feat: Add CI that tests the build for old architecture

* fix: Fix iOS CI

* fix: Fix CI

* fix: Exclude RN `.so` libraries (like `libjsi.so`) from `packagingOptions`
2024-10-07 15:47:31 +02:00
Marc RousavyandGitHub 992c709caf feat: Safely wrap a Swift closure in a C++ accessible SwiftClosure struct and allow parameters bi-directionally (#81)
* feat: Safely wrap a Swift closure in a `SwiftClosure` struct callable from C++

* Unsafely unwrap (`!`)

* fix: Fix visibility modifiers

* fix: Rename `ClosureWrapper` -> `SwiftClosure`

* Update SwiftClosure.hpp

* Update SwiftClosure.hpp

* Create `SwiftFunction` base

* regen

* feat: Properly create `std::function` from Swift closure

* fix: Forward params I think

* Update SwiftCxxBridgedType.ts

* feat: Use static function pointer to allow for C++ types

* fix: Only do this for Swift

* Update SwiftCxxBridgedType.ts

* fix: Properly unwrap using `Unmanaged`

* fix: Fix Swift compiler crash by moving function to `std::shared_ptr` before capturing it

* feat: Properly share func before capturing it

* Update SwiftCxxTypeHelper.ts
2024-08-29 15:21:25 +02:00
Marc Rousavy 67ad63781f chore: Rename repo to nitro 2024-08-20 23:54:35 +02:00
Marc RousavyandGitHub dbadcc2151 feat: Create AnyMapHolder for Swift (#56)
* feat: Create `AnyMapHolder` for Swift

* feat: Bridge other types

* fix: Fix types

* feat: Make all public

* fix: Remove Arrays because of the Swift compiler bug

* feat: Create `AnyMapHolder`

* fix: Rename record `someMap` to `someRecord`

* feat: Use `someMap`

* fix: Fix "22 duplicate symbols" by making the funcs inline

* Update README.md
2024-08-20 23:16:55 +02:00
Marc RousavyandGitHub 2c277fe6f0 feat: Support Promise<T> in Swift (#43)
* fix: Rename `wrap(wrappingDataWithoutCopy)`

* Update ArrayBufferHolder.swift

* Update ArrayBufferHolder.swift

* feat: Move to `utils/`

* feat: Create `Promise` base

* feat: Make `Promise` templated

* Delete HybridContext.cpp

* feat: Create `Promise<T>` in Swift

* Update Promise.swift

* feat: Add docs

* feat: Create `PromiseHolder`

* feat: Create

* `ArrayBuffer` ctors

* Create `PromiseHolder`

* feat: Convert from and to `PromiseHolder<T>`?

* fix: Remove wrong `Promise` declaration

* Update JSIConverter+Promise.hpp

* Update HybridSwiftKotlinTestObject.swift

* Update NitroModules.podspec
2024-08-15 18:30:43 +02:00
Marc RousavyandGitHub c31936286d feat: Support ArrayBuffer in Swift 🥳 (#37)
* feat: Support `ArrayBuffer` in Swift

* feat: Create `ArrayBufferHolder` that holds a `std::shared_ptr<ArrayBuffer>`

* fix: Fix `void*` cast in Swift

* feat: Create `.allocate(..)` helper init

* fix: Fix `initializeToZero`

* feat: Add `createNewBuffer`

* fix: regenerate missing specs

* fix: Move import to iOS only, on Android we dont have that

* chore: Format
2024-08-14 19:34:31 +02:00
Marc Rousavy 7f2ccbec0b fix: Move HybridContext.hpp to iOS 2024-08-05 17:44:40 +02:00
Marc Rousavy da52559049 fix: Fix some headers 2024-08-05 17:31:09 +02:00
Marc Rousavy 87eae31207 feat: Move to templates 2024-08-02 21:45:48 +02:00
Marc Rousavy 55b11ecd5a Expose a few more headers 2024-07-29 12:05:04 +02:00
Marc Rousavy 786f2e9f13 fix: Use shared NitroDefines 2024-07-29 12:03:06 +02:00
Marc Rousavy cbfba72218 fix: Remove ForeignArrayBuffer 2024-07-26 14:21:12 +02:00
Marc Rousavy 3f1cb16b31 Try to create ForeignArrayBuffer in swift 2024-07-25 18:04:45 +02:00
Marc Rousavy a4b45d1753 Revert "feat: Create Data based ArrayBuffer for Swift"
This reverts commit b310478a8d.
2024-07-25 17:33:20 +02:00
Marc Rousavy b310478a8d feat: Create Data based ArrayBuffer for Swift 2024-07-25 17:24:13 +02:00
Marc Rousavy 97b8f659a1 Define ArrayBuffer.hpp 2024-07-22 23:46:11 +02:00
Marc Rousavy c7338e3beb Remove cxxPart 2024-07-22 23:20:31 +02:00
Marc Rousavy 7c7c5ac6eb feat: Support functions! 2024-07-22 22:16:44 +02:00
Marc Rousavy 54753bbd7d Successfully register hybrid objects!! woohoo 2024-07-22 02:06:12 +02:00
Marc Rousavy 18d8fbe7c8 Expose Swift types I think 2024-07-22 00:56:46 +02:00
Marc Rousavy b3c17012e3 fix: Implement Image more 2024-07-18 16:07:22 +02:00
Marc Rousavy ec2be05bd6 feat: Don't expose header, fix cycle 2024-07-17 16:53:22 +02:00
Marc Rousavy 152d643edd fix: Fix cyclic Swift build 2024-07-17 13:19:37 +02:00
Marc Rousavy 4e1a25874f fix: Only expose some headers 2024-07-16 18:29:55 +02:00
Marc Rousavy 7075d72ae5 fix: Make all headers public 2024-07-16 18:21:08 +02:00
Marc Rousavy 19764548c3 Initialize CxxTurboModule 2024-06-21 13:28:19 +02:00
Marc Rousavy 0d77ac18d0 Set up CxxTurboModule 2024-06-21 13:07:41 +02:00
Marc Rousavy 166feb425f Create test object 2024-06-20 16:32:05 +02:00
Marc Rousavy 31696d7702 I can import it 2024-06-20 11:17:59 +02:00