Swift 4 Apple has introduced an update to Swift during its WWDC. Lets discuss some of the new features introduced in Swift 4. String In Swift 4, String has been revised to be a collection again. This gives the feature to reverse, sort and count the characters. Multi-Line String As String literals allows you to create a sequence of characters within quotes (“), Swift 4 starting to support multi-line characters. A multi-line string is enclosed within 3 quotes ("””). A multi-line can also include unescaped double quotes, carriage return and line feeds. To add a line feed, add a empty line to start and end of the multi-line string. The indentation defines the spacing between the lines. Example, let singleLineString = “I’m a single line string" let multilineString = “"" I’m a Multi line string. """ Protocol Composition Swift 4 allows developers to combine multiple protocols into a single type using protocol composition. It will be like ...
Comments
Post a Comment