@@ -330,7 +330,7 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
330
330
331
331
* [ SE-0328] [ ] :
332
332
333
- Opaque types (expressed with ' some' ) can now be used in structural positions
333
+ Opaque types (expressed with ` some ` ) can now be used in structural positions
334
334
within a result type, including having multiple opaque types in the same
335
335
result. For example:
336
336
@@ -942,7 +942,7 @@ Swift 5.5
942
942
}
943
943
```
944
944
945
- * The ' lazy' keyword now works in local contexts, making the following valid:
945
+ * The ` lazy ` keyword now works in local contexts, making the following valid:
946
946
947
947
``` swift
948
948
func test (useIt : Bool ) {
@@ -2901,7 +2901,7 @@ Swift 3.0
2901
2901
2902
2902
* [SE- 0101 ][]:
2903
2903
2904
- The functions `sizeof ()`, `strideof ()`, and `alignof ()` have been removed.
2904
+ The functions `sizeof ()`, `strideof ()`, and `alignof ()` have been removed.
2905
2905
Memory layout properties for a type `T` are now spelled
2906
2906
`MemoryLayout < T> .size `, `MemoryLayout < T> .stride `, and
2907
2907
`MemoryLayout < T> .alignment `, respectively.
@@ -2943,7 +2943,7 @@ Swift 3.0
2943
2943
2944
2944
* [SE- 0124 ][]:
2945
2945
2946
- Initializers on `Int ` and `UInt ` that accept an `ObjectIdentifier ` must now use an explicit `bitPattern` label.
2946
+ Initializers on `Int ` and `UInt ` that accept an `ObjectIdentifier ` must now use an explicit `bitPattern` label.
2947
2947
2948
2948
```swift
2949
2949
let x: ObjectIdentifier = ...
@@ -3199,7 +3199,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
3199
3199
didFailToRegisterForRemoteNotificationsWithError error: NSError)
3200
3200
```
3201
3201
3202
- Now it accepts an `Error ` argument:
3202
+ Now it accepts an `Error ` argument:
3203
3203
3204
3204
```swift
3205
3205
optional func application (_ application: UIApplication,
@@ -3422,7 +3422,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
3422
3422
foo/* comment */ ! // no longer works
3423
3423
```
3424
3424
3425
- Parse errors resulting from this change can be resolved by moving the comment outside the expression.
3425
+ Parse errors resulting from this change can be resolved by moving the comment outside the expression.
3426
3426
3427
3427
* [SE- 0031 ][]:
3428
3428
@@ -3483,7 +3483,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
3483
3483
Attributes change from using `= ` in parameters lists
3484
3484
to using `: `, aligning with function call syntax.
3485
3485
3486
- ```
3486
+ ```swift
3487
3487
// before
3488
3488
@available (* , unavailable , renamed="MyRenamedProtocol")
3489
3489
@@ -3524,13 +3524,13 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
3524
3524
3525
3525
Curried function syntax (with successive parenthesized groups of arguments) is removed, and now produces a compile- time error. Use chained functional return types instead.
3526
3526
3527
- ```
3528
- // Before
3529
- public func project (function f: FunctionType)(p0 : CGPoint, p1 : CGPoint)(x : CGFloat) -> CGPoint
3527
+ ```swift
3528
+ // Before
3529
+ public func project (function f: FunctionType)(p0 : CGPoint, p1 : CGPoint)(x : CGFloat) -> CGPoint
3530
3530
3531
- // After
3532
- public func project (function f: FunctionType) -> (p0 : CGPoint, p1 : CGPoint) -> (x : CGFloat) -> CGPoint
3533
- ```
3531
+ // After
3532
+ public func project (function f: FunctionType) -> (p0 : CGPoint, p1 : CGPoint) -> (x : CGFloat) -> CGPoint
3533
+ ```
3534
3534
3535
3535
* Generic signatures can now contain superclass requirements with generic parameter types, for example:
3536
3536
@@ -4877,11 +4877,15 @@ Swift 1.2
4877
4877
* The `@autoclosure ` attribute is now an attribute on a parameter, not an
4878
4878
attribute on the parameter's type.
4879
4879
4880
- Where before you might have used:
4880
+ Where before you might have used
4881
4881
4882
4882
```swift
4883
4883
func assert (predicate : @autoclosure () -> Bool ) {... }
4884
- you now write this as :
4884
+ ```
4885
+
4886
+ you now write this as
4887
+
4888
+ ```swift
4885
4889
func assert (@autoclosure predicate : () -> Bool ) {... }
4886
4890
```
4887
4891
@@ -4923,7 +4927,11 @@ Swift 1.2
4923
4927
// redeclares Objective-C method
4924
4928
// 'setProperty:'
4925
4929
}
4930
+ ```
4931
+
4926
4932
Similar checking applies to accidental overrides in the Objective- C runtime:
4933
+
4934
+ ```swift
4927
4935
class B : NSObject {
4928
4936
func method (arg : String ) { } // note: overridden declaration
4929
4937
// here has type '(String) -> ()'
@@ -4934,7 +4942,11 @@ Swift 1.2
4934
4942
// selector 'method:' has incompatible
4935
4943
// type '([String]) -> ()'
4936
4944
}
4945
+ ```
4946
+
4937
4947
as well as protocol conformances:
4948
+
4949
+ ```swift
4938
4950
class MyDelegate : NSObject, NSURLSessionDelegate {
4939
4951
func URLSession (session : NSURLSession, didBecomeInvalidWithError :
4940
4952
Bool ){ } // error: Objective-C method 'URLSession:didBecomeInvalidWithError:'
@@ -5022,13 +5034,17 @@ Swift 1.2
5022
5034
that used `unsafeBitCast` as a workaround for this issue can be written to
5023
5035
use the raw value initializer.
5024
5036
5025
- For example:
5037
+ For example,
5026
5038
5027
5039
```swift
5028
5040
let animationCurve =
5029
5041
unsafeBitCast (userInfo[UIKeyboardAnimationCurveUserInfoKey].integerValue ,
5030
5042
UIViewAnimationCurve.self )
5031
- can now be written instead as :
5043
+ ```
5044
+
5045
+ can now be written instead as
5046
+
5047
+ ```swift
5032
5048
let animationCurve = UIViewAnimationCurve (rawValue :
5033
5049
userInfo[UIKeyboardAnimationCurveUserInfoKey].integerValue )!
5034
5050
```
0 commit comments