Multiline statement in Swift -


i working on swift tutorial , found swift has strange way handle multi-line statement.

first, defined extension standard string class:

extension string {     func replace(target: string, withstring: string) -> string {         return self.stringbyreplacingoccurrencesofstring(target, withstring: withstring)     }      func tolowercase() -> string {         return self.lowercasestring     } } 

this works expected:

let str = "hello world" let s1 = str.lowercasestring.replace("hello", withstring: "goodbye") // -> goodbye world 

this doesn't work:

let s2 = str             .lowercasestring             .replace("hello", withstring: "goodbye") // error: not find member 'lowercasestring' 

if replace reference lowercasestring property function call, works again:

let s3 = str             .tolowercase()             .replace("hello", withstring: "goodbye") // -> goodbye world 

is there in swift language specifications prevent property broken onto own line?

code @ swift stub.

this compiler bug. issue has been resolved in xcode 7 beta 3.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -