@@ -10,7 +10,7 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
1010 It's now possible to use a default value expression with a generic parameter type
1111 to default the argument and its type:
1212
13- ```
13+ ``` swift
1414 func compute <C : Collection >(_ values : C = [0 , 1, 2]) {
1515 ...
1616 }
@@ -226,7 +226,7 @@ _**Note:** This is in reverse chronological order, so newer entries are added to
226226
227227* [ SE-0328] [ ] :
228228
229- Opaque types (expressed with ' some' ) can now be used in structural positions
229+ Opaque types (expressed with ` some ` ) can now be used in structural positions
230230 within a result type, including having multiple opaque types in the same
231231 result. For example:
232232
@@ -838,7 +838,7 @@ Swift 5.5
838838 }
839839 ```
840840
841- * The ' lazy' keyword now works in local contexts, making the following valid:
841+ * The ` lazy ` keyword now works in local contexts, making the following valid:
842842
843843 ``` swift
844844 func test (useIt : Bool ) {
@@ -2797,7 +2797,7 @@ Swift 3.0
27972797
27982798* [SE- 0101 ][]:
27992799
2800- The functions `sizeof ()`, `strideof ()`, and `alignof ()` have been removed.
2800+ The functions `sizeof ()`, `strideof ()`, and `alignof ()` have been removed.
28012801 Memory layout properties for a type `T` are now spelled
28022802 `MemoryLayout < T> .size `, `MemoryLayout < T> .stride `, and
28032803 `MemoryLayout < T> .alignment `, respectively.
@@ -2839,7 +2839,7 @@ Swift 3.0
28392839
28402840* [SE- 0124 ][]:
28412841
2842- Initializers on `Int ` and `UInt ` that accept an `ObjectIdentifier ` must now use an explicit `bitPattern` label.
2842+ Initializers on `Int ` and `UInt ` that accept an `ObjectIdentifier ` must now use an explicit `bitPattern` label.
28432843
28442844 ```swift
28452845 let x: ObjectIdentifier = ...
@@ -3095,7 +3095,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
30953095 didFailToRegisterForRemoteNotificationsWithError error: NSError)
30963096 ```
30973097
3098- Now it accepts an `Error ` argument:
3098+ Now it accepts an `Error ` argument:
30993099
31003100 ```swift
31013101 optional func application (_ application: UIApplication,
@@ -3318,7 +3318,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
33183318 foo/* comment */ ! // no longer works
33193319 ```
33203320
3321- Parse errors resulting from this change can be resolved by moving the comment outside the expression.
3321+ Parse errors resulting from this change can be resolved by moving the comment outside the expression.
33223322
33233323* [SE- 0031 ][]:
33243324
@@ -3379,7 +3379,7 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
33793379 Attributes change from using `= ` in parameters lists
33803380 to using `: `, aligning with function call syntax.
33813381
3382- ```
3382+ ```swift
33833383 // before
33843384 @available (* , unavailable , renamed="MyRenamedProtocol")
33853385
@@ -3420,13 +3420,13 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
34203420
34213421 Curried function syntax (with successive parenthesized groups of arguments) is removed, and now produces a compile- time error. Use chained functional return types instead.
34223422
3423- ```
3424- // Before
3425- public func project (function f: FunctionType)(p0 : CGPoint, p1 : CGPoint)(x : CGFloat) -> CGPoint
3423+ ```swift
3424+ // Before
3425+ public func project (function f: FunctionType)(p0 : CGPoint, p1 : CGPoint)(x : CGFloat) -> CGPoint
34263426
3427- // After
3428- public func project (function f: FunctionType) -> (p0 : CGPoint, p1 : CGPoint) -> (x : CGFloat) -> CGPoint
3429- ```
3427+ // After
3428+ public func project (function f: FunctionType) -> (p0 : CGPoint, p1 : CGPoint) -> (x : CGFloat) -> CGPoint
3429+ ```
34303430
34313431* Generic signatures can now contain superclass requirements with generic parameter types, for example:
34323432
@@ -4773,11 +4773,15 @@ Swift 1.2
47734773* The `@autoclosure ` attribute is now an attribute on a parameter, not an
47744774 attribute on the parameter's type.
47754775
4776- Where before you might have used:
4776+ Where before you might have used
47774777
47784778 ```swift
47794779 func assert (predicate : @autoclosure () -> Bool ) {... }
4780- you now write this as :
4780+ ```
4781+
4782+ you now write this as
4783+
4784+ ```swift
47814785 func assert (@autoclosure predicate : () -> Bool ) {... }
47824786 ```
47834787
@@ -4819,7 +4823,11 @@ Swift 1.2
48194823 // redeclares Objective-C method
48204824 // 'setProperty:'
48214825 }
4826+ ```
4827+
48224828 Similar checking applies to accidental overrides in the Objective- C runtime:
4829+
4830+ ```swift
48234831 class B : NSObject {
48244832 func method (arg : String ) { } // note: overridden declaration
48254833 // here has type '(String) -> ()'
@@ -4830,7 +4838,11 @@ Swift 1.2
48304838 // selector 'method:' has incompatible
48314839 // type '([String]) -> ()'
48324840 }
4841+ ```
4842+
48334843 as well as protocol conformances:
4844+
4845+ ```swift
48344846 class MyDelegate : NSObject, NSURLSessionDelegate {
48354847 func URLSession (session : NSURLSession, didBecomeInvalidWithError :
48364848 Bool ){ } // error: Objective-C method 'URLSession:didBecomeInvalidWithError:'
@@ -4918,13 +4930,17 @@ Swift 1.2
49184930 that used `unsafeBitCast` as a workaround for this issue can be written to
49194931 use the raw value initializer.
49204932
4921- For example:
4933+ For example,
49224934
49234935 ```swift
49244936 let animationCurve =
49254937 unsafeBitCast (userInfo[UIKeyboardAnimationCurveUserInfoKey].integerValue ,
49264938 UIViewAnimationCurve.self )
4927- can now be written instead as :
4939+ ```
4940+
4941+ can now be written instead as
4942+
4943+ ```swift
49284944 let animationCurve = UIViewAnimationCurve (rawValue :
49294945 userInfo[UIKeyboardAnimationCurveUserInfoKey].integerValue )!
49304946 ```
0 commit comments