Skip to content

Commit 90078b0

Browse files
committed
Add SE-0160: Limiting @objc inference to the ChangeLog
1 parent 979d53a commit 90078b0

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,32 @@ CHANGELOG
2121
Swift 4.0
2222
---------
2323

24+
* [SE-0160][]
25+
26+
In Swift 4 mode, a declaration is inferred to be `@objc` where it is required for semantic consistency of the programming model. Specifically, it is inferred when:
27+
28+
* The declaration is an override of an `@objc` declaration
29+
* The declaration satisfies a requirement in an `@objc` protocol
30+
* The declaration has one of the following attributes: `@IBAction`, `@IBOutlet`, `@IBInspectable`, `@GKInspectable`, or `@NSManaged`
31+
32+
Additionally, in Swift 4 mode, `dynamic` declarations that don't
33+
have `@objc` inferred based on the rules above will need to be
34+
explicitly marked `@objc`.
35+
36+
Swift 3 compatibility mode retains the more-permissive Swift 3
37+
rules for inference of `@objc` within subclasses of
38+
`NSObject`. However, the compiler will emit warnings about places
39+
where the Objective-C entry points for these inference cases are
40+
used, e.g., in a `#selector` or `#keyPath` expression, via
41+
messaging through `AnyObject`, or direct uses in Objective-C code
42+
within a mixed project. The warnings can be silenced by adding an
43+
explicit `@objc`. Uses of these entrypoints that are not
44+
statically visible to the compiler can be diagnosed at runtime by
45+
setting the environment variable
46+
`SWIFT_DEBUG_IMPLICIT_OBJC_ENTRYPOINT` to a value between 1 and 3
47+
and testing the application. See the [migration discussion in
48+
SE-0160](https://github.com/apple/swift-evolution/blob/master/proposals/0160-objc-inference.md#minimal-migration-workflow).
49+
2450
* [SE-0138](https://github.com/apple/swift-evolution/blob/master/proposals/0138-unsaferawbufferpointer.md#amendment-to-normalize-the-slice-type):
2551

2652
Slicing a raw buffer no longer results in the same raw buffer

0 commit comments

Comments
 (0)