@dawidzawada/bonjour-zeroconf 1.0.1 → 1.2.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +30 -0
  2. package/android/src/main/java/com/margelo/nitro/dawidzawada/bonjourzeroconf/BonjourZeroconf+AddressResolver.kt +14 -0
  3. package/android/src/main/java/com/margelo/nitro/dawidzawada/bonjourzeroconf/BonjourZeroconf.kt +25 -1
  4. package/ios/AddressResolverError.swift +13 -10
  5. package/ios/BonjourZeroconf+AddressResolver.swift +58 -21
  6. package/ios/BonjourZeroconf.swift +21 -0
  7. package/ios/LocalNetworkAuthorization.swift +0 -1
  8. package/lib/typescript/src/specs/BonjourZeroconf.nitro.d.ts +1 -0
  9. package/lib/typescript/src/specs/BonjourZeroconf.nitro.d.ts.map +1 -1
  10. package/nitrogen/generated/android/c++/JBonjourFail.hpp +4 -5
  11. package/nitrogen/generated/android/c++/JBonjourListener.hpp +3 -4
  12. package/nitrogen/generated/android/c++/JFunc_void.hpp +3 -2
  13. package/nitrogen/generated/android/c++/JFunc_void_BonjourFail.hpp +3 -2
  14. package/nitrogen/generated/android/c++/JFunc_void_bool.hpp +3 -2
  15. package/nitrogen/generated/android/c++/JFunc_void_std__vector_ScanResult_.hpp +3 -2
  16. package/nitrogen/generated/android/c++/JHybridBonjourZeroconfSpec.cpp +43 -8
  17. package/nitrogen/generated/android/c++/JHybridBonjourZeroconfSpec.hpp +3 -1
  18. package/nitrogen/generated/android/c++/JScanOptions.hpp +1 -1
  19. package/nitrogen/generated/android/c++/JScanResult.hpp +1 -1
  20. package/nitrogen/generated/android/dawidzawada_bonjourzeroconf+autolinking.cmake +1 -1
  21. package/nitrogen/generated/android/dawidzawada_bonjourzeroconf+autolinking.gradle +1 -1
  22. package/nitrogen/generated/android/dawidzawada_bonjourzeroconfOnLoad.cpp +1 -1
  23. package/nitrogen/generated/android/dawidzawada_bonjourzeroconfOnLoad.hpp +1 -1
  24. package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/BonjourFail.kt +3 -1
  25. package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/BonjourListener.kt +2 -2
  26. package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/Func_void.kt +1 -1
  27. package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/Func_void_BonjourFail.kt +1 -1
  28. package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/Func_void_bool.kt +1 -1
  29. package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/Func_void_std__vector_ScanResult_.kt +1 -1
  30. package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/HybridBonjourZeroconfSpec.kt +6 -1
  31. package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/ScanOptions.kt +2 -2
  32. package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/ScanResult.kt +2 -2
  33. package/nitrogen/generated/android/kotlin/com/margelo/nitro/dawidzawada/bonjourzeroconf/dawidzawada_bonjourzeroconfOnLoad.kt +1 -1
  34. package/nitrogen/generated/ios/BonjourZeroconf+autolinking.rb +2 -2
  35. package/nitrogen/generated/ios/BonjourZeroconf-Swift-Cxx-Bridge.cpp +17 -17
  36. package/nitrogen/generated/ios/BonjourZeroconf-Swift-Cxx-Bridge.hpp +73 -52
  37. package/nitrogen/generated/ios/BonjourZeroconf-Swift-Cxx-Umbrella.hpp +1 -1
  38. package/nitrogen/generated/ios/BonjourZeroconfAutolinking.mm +1 -1
  39. package/nitrogen/generated/ios/BonjourZeroconfAutolinking.swift +1 -1
  40. package/nitrogen/generated/ios/c++/HybridBonjourZeroconfSpecSwift.cpp +1 -1
  41. package/nitrogen/generated/ios/c++/HybridBonjourZeroconfSpecSwift.hpp +20 -5
  42. package/nitrogen/generated/ios/c++/HybridLocalNetworkPermissionSpecSwift.cpp +1 -1
  43. package/nitrogen/generated/ios/c++/HybridLocalNetworkPermissionSpecSwift.hpp +7 -1
  44. package/nitrogen/generated/ios/swift/BonjourFail.swift +1 -1
  45. package/nitrogen/generated/ios/swift/BonjourListener.swift +8 -17
  46. package/nitrogen/generated/ios/swift/Func_void.swift +1 -1
  47. package/nitrogen/generated/ios/swift/Func_void_BonjourFail.swift +1 -1
  48. package/nitrogen/generated/ios/swift/Func_void_bool.swift +1 -1
  49. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +1 -1
  50. package/nitrogen/generated/ios/swift/Func_void_std__vector_ScanResult_.swift +6 -6
  51. package/nitrogen/generated/ios/swift/HybridBonjourZeroconfSpec.swift +2 -1
  52. package/nitrogen/generated/ios/swift/HybridBonjourZeroconfSpec_cxx.swift +34 -1
  53. package/nitrogen/generated/ios/swift/HybridLocalNetworkPermissionSpec.swift +1 -1
  54. package/nitrogen/generated/ios/swift/HybridLocalNetworkPermissionSpec_cxx.swift +9 -1
  55. package/nitrogen/generated/ios/swift/ScanOptions.swift +3 -15
  56. package/nitrogen/generated/ios/swift/ScanResult.swift +32 -86
  57. package/nitrogen/generated/shared/c++/BonjourFail.hpp +1 -1
  58. package/nitrogen/generated/shared/c++/BonjourListener.hpp +13 -5
  59. package/nitrogen/generated/shared/c++/HybridBonjourZeroconfSpec.cpp +2 -1
  60. package/nitrogen/generated/shared/c++/HybridBonjourZeroconfSpec.hpp +6 -4
  61. package/nitrogen/generated/shared/c++/HybridLocalNetworkPermissionSpec.cpp +1 -1
  62. package/nitrogen/generated/shared/c++/HybridLocalNetworkPermissionSpec.hpp +1 -1
  63. package/nitrogen/generated/shared/c++/ScanOptions.hpp +13 -5
  64. package/nitrogen/generated/shared/c++/ScanResult.hpp +25 -17
  65. package/package.json +5 -6
  66. package/src/specs/BonjourZeroconf.nitro.ts +7 -0
@@ -2,7 +2,7 @@
2
2
  # dawidzawada_bonjourzeroconf+autolinking.cmake
3
3
  # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  # https://github.com/mrousavy/nitro
5
- # Copyright © 2025 Marc Rousavy @ Margelo
5
+ # Copyright © Marc Rousavy @ Margelo
6
6
  #
7
7
 
8
8
  # This is a CMake file that adds all files generated by Nitrogen
@@ -2,7 +2,7 @@
2
2
  /// dawidzawada_bonjourzeroconf+autolinking.gradle
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  /// This is a Gradle file that adds all files generated by Nitrogen
@@ -2,7 +2,7 @@
2
2
  /// dawidzawada_bonjourzeroconfOnLoad.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #ifndef BUILDING_DAWIDZAWADABONJOURZEROCONF_WITH_GENERATED_CMAKE_PROJECT
@@ -2,7 +2,7 @@
2
2
  /// dawidzawada_bonjourzeroconfOnLoad.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include <jni.h>
@@ -2,7 +2,7 @@
2
2
  /// BonjourFail.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.dawidzawada.bonjourzeroconf
@@ -19,4 +19,6 @@ enum class BonjourFail(@DoNotStrip @Keep val value: Int) {
19
19
  RESOLVE_FAILED(0),
20
20
  EXTRACTION_FAILED(1),
21
21
  DISCOVERY_FAILED(2);
22
+
23
+ companion object
22
24
  }
@@ -2,7 +2,7 @@
2
2
  /// BonjourListener.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.dawidzawada.bonjourzeroconf
@@ -27,7 +27,7 @@ data class BonjourListener(
27
27
  constructor(remove: () -> Unit):
28
28
  this(Func_void_java(remove))
29
29
 
30
- private companion object {
30
+ companion object {
31
31
  /**
32
32
  * Constructor called from C++
33
33
  */
@@ -2,7 +2,7 @@
2
2
  /// Func_void.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.dawidzawada.bonjourzeroconf
@@ -2,7 +2,7 @@
2
2
  /// Func_void_BonjourFail.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.dawidzawada.bonjourzeroconf
@@ -2,7 +2,7 @@
2
2
  /// Func_void_bool.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.dawidzawada.bonjourzeroconf
@@ -2,7 +2,7 @@
2
2
  /// Func_void_std__vector_ScanResult_.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.dawidzawada.bonjourzeroconf
@@ -2,7 +2,7 @@
2
2
  /// HybridBonjourZeroconfSpec.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.dawidzawada.bonjourzeroconf
@@ -10,6 +10,7 @@ package com.margelo.nitro.dawidzawada.bonjourzeroconf
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.jni.HybridData
12
12
  import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.Promise
13
14
  import com.margelo.nitro.core.HybridObject
14
15
 
15
16
  /**
@@ -51,6 +52,10 @@ abstract class HybridBonjourZeroconfSpec: HybridObject() {
51
52
  @Keep
52
53
  abstract fun scan(type: String, domain: String, options: ScanOptions?): Unit
53
54
 
55
+ @DoNotStrip
56
+ @Keep
57
+ abstract fun scanFor(time: Double, type: String, domain: String, options: ScanOptions?): Promise<Array<ScanResult>>
58
+
54
59
  @DoNotStrip
55
60
  @Keep
56
61
  abstract fun stop(): Unit
@@ -2,7 +2,7 @@
2
2
  /// ScanOptions.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.dawidzawada.bonjourzeroconf
@@ -23,7 +23,7 @@ data class ScanOptions(
23
23
  ) {
24
24
  /* primary constructor */
25
25
 
26
- private companion object {
26
+ companion object {
27
27
  /**
28
28
  * Constructor called from C++
29
29
  */
@@ -2,7 +2,7 @@
2
2
  /// ScanResult.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.dawidzawada.bonjourzeroconf
@@ -35,7 +35,7 @@ data class ScanResult(
35
35
  ) {
36
36
  /* primary constructor */
37
37
 
38
- private companion object {
38
+ companion object {
39
39
  /**
40
40
  * Constructor called from C++
41
41
  */
@@ -2,7 +2,7 @@
2
2
  /// dawidzawada_bonjourzeroconfOnLoad.kt
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  package com.margelo.nitro.dawidzawada.bonjourzeroconf
@@ -2,7 +2,7 @@
2
2
  # BonjourZeroconf+autolinking.rb
3
3
  # This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  # https://github.com/mrousavy/nitro
5
- # Copyright © 2025 Marc Rousavy @ Margelo
5
+ # Copyright © Marc Rousavy @ Margelo
6
6
  #
7
7
 
8
8
  # This is a Ruby script that adds all files generated by Nitrogen
@@ -52,7 +52,7 @@ def add_nitrogen_files(spec)
52
52
  spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
53
53
  # Use C++ 20
54
54
  "CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
55
- # Enables C++ <-> Swift interop (by default it's only C)
55
+ # Enables C++ <-> Swift interop (by default it's only ObjC)
56
56
  "SWIFT_OBJC_INTEROP_MODE" => "objcxx",
57
57
  # Enables stricter modular headers
58
58
  "DEFINES_MODULE" => "YES",
@@ -2,7 +2,7 @@
2
2
  /// BonjourZeroconf-Swift-Cxx-Bridge.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "BonjourZeroconf-Swift-Cxx-Bridge.hpp"
@@ -15,6 +15,22 @@
15
15
 
16
16
  namespace margelo::nitro::dawidzawada_bonjourzeroconf::bridge::swift {
17
17
 
18
+ // pragma MARK: std::function<void(const std::vector<ScanResult>& /* result */)>
19
+ Func_void_std__vector_ScanResult_ create_Func_void_std__vector_ScanResult_(void* NON_NULL swiftClosureWrapper) noexcept {
20
+ auto swiftClosure = BonjourZeroconf::Func_void_std__vector_ScanResult_::fromUnsafe(swiftClosureWrapper);
21
+ return [swiftClosure = std::move(swiftClosure)](const std::vector<ScanResult>& result) mutable -> void {
22
+ swiftClosure.call(result);
23
+ };
24
+ }
25
+
26
+ // pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
27
+ Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
28
+ auto swiftClosure = BonjourZeroconf::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
29
+ return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
30
+ swiftClosure.call(error);
31
+ };
32
+ }
33
+
18
34
  // pragma MARK: std::function<void()>
19
35
  Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
20
36
  auto swiftClosure = BonjourZeroconf::Func_void::fromUnsafe(swiftClosureWrapper);
@@ -23,14 +39,6 @@ namespace margelo::nitro::dawidzawada_bonjourzeroconf::bridge::swift {
23
39
  };
24
40
  }
25
41
 
26
- // pragma MARK: std::function<void(const std::vector<ScanResult>& /* results */)>
27
- Func_void_std__vector_ScanResult_ create_Func_void_std__vector_ScanResult_(void* NON_NULL swiftClosureWrapper) noexcept {
28
- auto swiftClosure = BonjourZeroconf::Func_void_std__vector_ScanResult_::fromUnsafe(swiftClosureWrapper);
29
- return [swiftClosure = std::move(swiftClosure)](const std::vector<ScanResult>& results) mutable -> void {
30
- swiftClosure.call(results);
31
- };
32
- }
33
-
34
42
  // pragma MARK: std::function<void(bool /* isScanning */)>
35
43
  Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
36
44
  auto swiftClosure = BonjourZeroconf::Func_void_bool::fromUnsafe(swiftClosureWrapper);
@@ -63,14 +71,6 @@ namespace margelo::nitro::dawidzawada_bonjourzeroconf::bridge::swift {
63
71
  return swiftPart.toUnsafe();
64
72
  }
65
73
 
66
- // pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
67
- Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
68
- auto swiftClosure = BonjourZeroconf::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
69
- return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
70
- swiftClosure.call(error);
71
- };
72
- }
73
-
74
74
  // pragma MARK: std::shared_ptr<HybridLocalNetworkPermissionSpec>
75
75
  std::shared_ptr<HybridLocalNetworkPermissionSpec> create_std__shared_ptr_HybridLocalNetworkPermissionSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
76
76
  BonjourZeroconf::HybridLocalNetworkPermissionSpec_cxx swiftPart = BonjourZeroconf::HybridLocalNetworkPermissionSpec_cxx::fromUnsafe(swiftUnsafePointer);
@@ -2,7 +2,7 @@
2
2
  /// BonjourZeroconf-Swift-Cxx-Bridge.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -80,28 +80,6 @@ namespace margelo::nitro::dawidzawada_bonjourzeroconf::bridge::swift {
80
80
  return *optional;
81
81
  }
82
82
 
83
- // pragma MARK: std::function<void()>
84
- /**
85
- * Specialized version of `std::function<void()>`.
86
- */
87
- using Func_void = std::function<void()>;
88
- /**
89
- * Wrapper class for a `std::function<void()>`, this can be used from Swift.
90
- */
91
- class Func_void_Wrapper final {
92
- public:
93
- explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {}
94
- inline void call() const noexcept {
95
- _function->operator()();
96
- }
97
- private:
98
- std::unique_ptr<std::function<void()>> _function;
99
- } SWIFT_NONCOPYABLE;
100
- Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept;
101
- inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
102
- return Func_void_Wrapper(std::move(value));
103
- }
104
-
105
83
  // pragma MARK: std::optional<std::string>
106
84
  /**
107
85
  * Specialized version of `std::optional<std::string>`.
@@ -128,28 +106,84 @@ namespace margelo::nitro::dawidzawada_bonjourzeroconf::bridge::swift {
128
106
  return vector;
129
107
  }
130
108
 
131
- // pragma MARK: std::function<void(const std::vector<ScanResult>& /* results */)>
109
+ // pragma MARK: std::shared_ptr<Promise<std::vector<ScanResult>>>
110
+ /**
111
+ * Specialized version of `std::shared_ptr<Promise<std::vector<ScanResult>>>`.
112
+ */
113
+ using std__shared_ptr_Promise_std__vector_ScanResult___ = std::shared_ptr<Promise<std::vector<ScanResult>>>;
114
+ inline std::shared_ptr<Promise<std::vector<ScanResult>>> create_std__shared_ptr_Promise_std__vector_ScanResult___() noexcept {
115
+ return Promise<std::vector<ScanResult>>::create();
116
+ }
117
+ inline PromiseHolder<std::vector<ScanResult>> wrap_std__shared_ptr_Promise_std__vector_ScanResult___(std::shared_ptr<Promise<std::vector<ScanResult>>> promise) noexcept {
118
+ return PromiseHolder<std::vector<ScanResult>>(std::move(promise));
119
+ }
120
+
121
+ // pragma MARK: std::function<void(const std::vector<ScanResult>& /* result */)>
132
122
  /**
133
123
  * Specialized version of `std::function<void(const std::vector<ScanResult>&)>`.
134
124
  */
135
- using Func_void_std__vector_ScanResult_ = std::function<void(const std::vector<ScanResult>& /* results */)>;
125
+ using Func_void_std__vector_ScanResult_ = std::function<void(const std::vector<ScanResult>& /* result */)>;
136
126
  /**
137
- * Wrapper class for a `std::function<void(const std::vector<ScanResult>& / * results * /)>`, this can be used from Swift.
127
+ * Wrapper class for a `std::function<void(const std::vector<ScanResult>& / * result * /)>`, this can be used from Swift.
138
128
  */
139
129
  class Func_void_std__vector_ScanResult__Wrapper final {
140
130
  public:
141
- explicit Func_void_std__vector_ScanResult__Wrapper(std::function<void(const std::vector<ScanResult>& /* results */)>&& func): _function(std::make_unique<std::function<void(const std::vector<ScanResult>& /* results */)>>(std::move(func))) {}
142
- inline void call(std::vector<ScanResult> results) const noexcept {
143
- _function->operator()(results);
131
+ explicit Func_void_std__vector_ScanResult__Wrapper(std::function<void(const std::vector<ScanResult>& /* result */)>&& func): _function(std::make_unique<std::function<void(const std::vector<ScanResult>& /* result */)>>(std::move(func))) {}
132
+ inline void call(std::vector<ScanResult> result) const noexcept {
133
+ _function->operator()(result);
144
134
  }
145
135
  private:
146
- std::unique_ptr<std::function<void(const std::vector<ScanResult>& /* results */)>> _function;
136
+ std::unique_ptr<std::function<void(const std::vector<ScanResult>& /* result */)>> _function;
147
137
  } SWIFT_NONCOPYABLE;
148
138
  Func_void_std__vector_ScanResult_ create_Func_void_std__vector_ScanResult_(void* NON_NULL swiftClosureWrapper) noexcept;
149
139
  inline Func_void_std__vector_ScanResult__Wrapper wrap_Func_void_std__vector_ScanResult_(Func_void_std__vector_ScanResult_ value) noexcept {
150
140
  return Func_void_std__vector_ScanResult__Wrapper(std::move(value));
151
141
  }
152
142
 
143
+ // pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
144
+ /**
145
+ * Specialized version of `std::function<void(const std::exception_ptr&)>`.
146
+ */
147
+ using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
148
+ /**
149
+ * Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
150
+ */
151
+ class Func_void_std__exception_ptr_Wrapper final {
152
+ public:
153
+ explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
154
+ inline void call(std::exception_ptr error) const noexcept {
155
+ _function->operator()(error);
156
+ }
157
+ private:
158
+ std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
159
+ } SWIFT_NONCOPYABLE;
160
+ Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
161
+ inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
162
+ return Func_void_std__exception_ptr_Wrapper(std::move(value));
163
+ }
164
+
165
+ // pragma MARK: std::function<void()>
166
+ /**
167
+ * Specialized version of `std::function<void()>`.
168
+ */
169
+ using Func_void = std::function<void()>;
170
+ /**
171
+ * Wrapper class for a `std::function<void()>`, this can be used from Swift.
172
+ */
173
+ class Func_void_Wrapper final {
174
+ public:
175
+ explicit Func_void_Wrapper(std::function<void()>&& func): _function(std::make_unique<std::function<void()>>(std::move(func))) {}
176
+ inline void call() const noexcept {
177
+ _function->operator()();
178
+ }
179
+ private:
180
+ std::unique_ptr<std::function<void()>> _function;
181
+ } SWIFT_NONCOPYABLE;
182
+ Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept;
183
+ inline Func_void_Wrapper wrap_Func_void(Func_void value) noexcept {
184
+ return Func_void_Wrapper(std::move(value));
185
+ }
186
+
153
187
  // pragma MARK: std::function<void(bool /* isScanning */)>
154
188
  /**
155
189
  * Specialized version of `std::function<void(bool)>`.
@@ -215,6 +249,15 @@ namespace margelo::nitro::dawidzawada_bonjourzeroconf::bridge::swift {
215
249
  return Result<void>::withError(error);
216
250
  }
217
251
 
252
+ // pragma MARK: Result<std::shared_ptr<Promise<std::vector<ScanResult>>>>
253
+ using Result_std__shared_ptr_Promise_std__vector_ScanResult____ = Result<std::shared_ptr<Promise<std::vector<ScanResult>>>>;
254
+ inline Result_std__shared_ptr_Promise_std__vector_ScanResult____ create_Result_std__shared_ptr_Promise_std__vector_ScanResult____(const std::shared_ptr<Promise<std::vector<ScanResult>>>& value) noexcept {
255
+ return Result<std::shared_ptr<Promise<std::vector<ScanResult>>>>::withValue(value);
256
+ }
257
+ inline Result_std__shared_ptr_Promise_std__vector_ScanResult____ create_Result_std__shared_ptr_Promise_std__vector_ScanResult____(const std::exception_ptr& error) noexcept {
258
+ return Result<std::shared_ptr<Promise<std::vector<ScanResult>>>>::withError(error);
259
+ }
260
+
218
261
  // pragma MARK: Result<BonjourListener>
219
262
  using Result_BonjourListener_ = Result<BonjourListener>;
220
263
  inline Result_BonjourListener_ create_Result_BonjourListener_(const BonjourListener& value) noexcept {
@@ -236,28 +279,6 @@ namespace margelo::nitro::dawidzawada_bonjourzeroconf::bridge::swift {
236
279
  return PromiseHolder<bool>(std::move(promise));
237
280
  }
238
281
 
239
- // pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
240
- /**
241
- * Specialized version of `std::function<void(const std::exception_ptr&)>`.
242
- */
243
- using Func_void_std__exception_ptr = std::function<void(const std::exception_ptr& /* error */)>;
244
- /**
245
- * Wrapper class for a `std::function<void(const std::exception_ptr& / * error * /)>`, this can be used from Swift.
246
- */
247
- class Func_void_std__exception_ptr_Wrapper final {
248
- public:
249
- explicit Func_void_std__exception_ptr_Wrapper(std::function<void(const std::exception_ptr& /* error */)>&& func): _function(std::make_unique<std::function<void(const std::exception_ptr& /* error */)>>(std::move(func))) {}
250
- inline void call(std::exception_ptr error) const noexcept {
251
- _function->operator()(error);
252
- }
253
- private:
254
- std::unique_ptr<std::function<void(const std::exception_ptr& /* error */)>> _function;
255
- } SWIFT_NONCOPYABLE;
256
- Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept;
257
- inline Func_void_std__exception_ptr_Wrapper wrap_Func_void_std__exception_ptr(Func_void_std__exception_ptr value) noexcept {
258
- return Func_void_std__exception_ptr_Wrapper(std::move(value));
259
- }
260
-
261
282
  // pragma MARK: std::shared_ptr<HybridLocalNetworkPermissionSpec>
262
283
  /**
263
284
  * Specialized version of `std::shared_ptr<HybridLocalNetworkPermissionSpec>`.
@@ -2,7 +2,7 @@
2
2
  /// BonjourZeroconf-Swift-Cxx-Umbrella.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -2,7 +2,7 @@
2
2
  /// BonjourZeroconfAutolinking.mm
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #import <Foundation/Foundation.h>
@@ -2,7 +2,7 @@
2
2
  /// BonjourZeroconfAutolinking.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  public final class BonjourZeroconfAutolinking {
@@ -2,7 +2,7 @@
2
2
  /// HybridBonjourZeroconfSpecSwift.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "HybridBonjourZeroconfSpecSwift.hpp"
@@ -2,7 +2,7 @@
2
2
  /// HybridBonjourZeroconfSpecSwift.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -14,20 +14,21 @@ namespace BonjourZeroconf { class HybridBonjourZeroconfSpec_cxx; }
14
14
 
15
15
  // Forward declaration of `ScanOptions` to properly resolve imports.
16
16
  namespace margelo::nitro::dawidzawada_bonjourzeroconf { struct ScanOptions; }
17
- // Forward declaration of `BonjourListener` to properly resolve imports.
18
- namespace margelo::nitro::dawidzawada_bonjourzeroconf { struct BonjourListener; }
19
17
  // Forward declaration of `ScanResult` to properly resolve imports.
20
18
  namespace margelo::nitro::dawidzawada_bonjourzeroconf { struct ScanResult; }
19
+ // Forward declaration of `BonjourListener` to properly resolve imports.
20
+ namespace margelo::nitro::dawidzawada_bonjourzeroconf { struct BonjourListener; }
21
21
  // Forward declaration of `BonjourFail` to properly resolve imports.
22
22
  namespace margelo::nitro::dawidzawada_bonjourzeroconf { enum class BonjourFail; }
23
23
 
24
24
  #include <string>
25
25
  #include "ScanOptions.hpp"
26
26
  #include <optional>
27
- #include "BonjourListener.hpp"
28
- #include <functional>
29
27
  #include "ScanResult.hpp"
30
28
  #include <vector>
29
+ #include <NitroModules/Promise.hpp>
30
+ #include "BonjourListener.hpp"
31
+ #include <functional>
31
32
  #include "BonjourFail.hpp"
32
33
 
33
34
  #include "BonjourZeroconf-Swift-Cxx-Umbrella.hpp"
@@ -61,6 +62,12 @@ namespace margelo::nitro::dawidzawada_bonjourzeroconf {
61
62
  inline size_t getExternalMemorySize() noexcept override {
62
63
  return _swiftPart.getMemorySize();
63
64
  }
65
+ bool equals(const std::shared_ptr<HybridObject>& other) override {
66
+ if (auto otherCast = std::dynamic_pointer_cast<HybridBonjourZeroconfSpecSwift>(other)) {
67
+ return _swiftPart.equals(otherCast->_swiftPart);
68
+ }
69
+ return false;
70
+ }
64
71
  void dispose() noexcept override {
65
72
  _swiftPart.dispose();
66
73
  }
@@ -82,6 +89,14 @@ namespace margelo::nitro::dawidzawada_bonjourzeroconf {
82
89
  std::rethrow_exception(__result.error());
83
90
  }
84
91
  }
92
+ inline std::shared_ptr<Promise<std::vector<ScanResult>>> scanFor(double time, const std::string& type, const std::string& domain, const std::optional<ScanOptions>& options) override {
93
+ auto __result = _swiftPart.scanFor(std::forward<decltype(time)>(time), type, domain, options);
94
+ if (__result.hasError()) [[unlikely]] {
95
+ std::rethrow_exception(__result.error());
96
+ }
97
+ auto __value = std::move(__result.value());
98
+ return __value;
99
+ }
85
100
  inline void stop() override {
86
101
  auto __result = _swiftPart.stop();
87
102
  if (__result.hasError()) [[unlikely]] {
@@ -2,7 +2,7 @@
2
2
  /// HybridLocalNetworkPermissionSpecSwift.cpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #include "HybridLocalNetworkPermissionSpecSwift.hpp"
@@ -2,7 +2,7 @@
2
2
  /// HybridLocalNetworkPermissionSpecSwift.hpp
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  #pragma once
@@ -50,6 +50,12 @@ namespace margelo::nitro::dawidzawada_bonjourzeroconf {
50
50
  inline size_t getExternalMemorySize() noexcept override {
51
51
  return _swiftPart.getMemorySize();
52
52
  }
53
+ bool equals(const std::shared_ptr<HybridObject>& other) override {
54
+ if (auto otherCast = std::dynamic_pointer_cast<HybridLocalNetworkPermissionSpecSwift>(other)) {
55
+ return _swiftPart.equals(otherCast->_swiftPart);
56
+ }
57
+ return false;
58
+ }
53
59
  void dispose() noexcept override {
54
60
  _swiftPart.dispose();
55
61
  }
@@ -2,7 +2,7 @@
2
2
  /// BonjourFail.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  /**
@@ -2,7 +2,7 @@
2
2
  /// BonjourListener.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  import Foundation
@@ -26,22 +26,13 @@ public extension BonjourListener {
26
26
  }())
27
27
  }
28
28
 
29
+ @inline(__always)
29
30
  var remove: () -> Void {
30
- @inline(__always)
31
- get {
32
- return { () -> () -> Void in
33
- let __wrappedFunction = bridge.wrap_Func_void(self.__remove)
34
- return { () -> Void in
35
- __wrappedFunction.call()
36
- }
37
- }()
38
- }
39
- @inline(__always)
40
- set {
41
- self.__remove = { () -> bridge.Func_void in
42
- let __closureWrapper = Func_void(newValue)
43
- return bridge.create_Func_void(__closureWrapper.toUnsafe())
44
- }()
45
- }
31
+ return { () -> () -> Void in
32
+ let __wrappedFunction = bridge.wrap_Func_void(self.__remove)
33
+ return { () -> Void in
34
+ __wrappedFunction.call()
35
+ }
36
+ }()
46
37
  }
47
38
  }
@@ -2,7 +2,7 @@
2
2
  /// Func_void.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  import Foundation
@@ -2,7 +2,7 @@
2
2
  /// Func_void_BonjourFail.swift
3
3
  /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
4
  /// https://github.com/mrousavy/nitro
5
- /// Copyright © 2025 Marc Rousavy @ Margelo
5
+ /// Copyright © Marc Rousavy @ Margelo
6
6
  ///
7
7
 
8
8
  import Foundation