Skip to content

Commit 9c129a1

Browse files
authored
Merge pull request #207 from Fokka-Engineering/swift-compatibility
2 parents 31b9b72 + a906d29 commit 9c129a1

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Headers/Foundation/NSObjCRuntime.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,37 @@ extern "C" {
167167
# define NS_ASSUME_NONNULL_END
168168
#endif
169169

170+
#if !__has_feature(nullability)
171+
# ifndef _Nullable
172+
# define _Nullable
173+
# endif
174+
# ifndef _Nonnull
175+
# define _Nonnull
176+
# endif
177+
# ifndef _Null_unspecified
178+
# define _Null_unspecified
179+
# endif
180+
#endif
181+
182+
/*
183+
* Any argument that is passed inside a block is not going to escape
184+
* the runtime of the function itself.
185+
*/
186+
#if __has_attribute(noescape)
187+
# define NS_NOESCAPE __attribute__((noescape))
188+
#else
189+
# define NS_NOESCAPE
190+
#endif
191+
192+
/*
193+
* Prevent NSError from being imported by Swift as a method that throws.
194+
*/
195+
#if __has_attribute(swift_error)
196+
# define NS_SWIFT_NOTHROW __attribute__((swift_error(none)))
197+
#else
198+
# define NS_SWIFT_NOTHROW
199+
#endif
200+
170201
/*
171202
* Backwards compatibility macro for instance type.
172203
*/

0 commit comments

Comments
 (0)