Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS

Kavita Bargota
Kavita Bargota
2,741 Points

can someone please help with a multiline string literal in Swift??

I am reading through notes attached to the video tutorials and practicing the notes on Xcode playground. I have copied the following onto Xcode:

let singleLineString = "These are the same." let multilineString = """ These are the same. """ and there is an error in the code?

it does not make sense to me as I am literally copying what Swifts guidance says...

does anyone know whats happening?

thanks

2 Answers

Tijo Thomas
Tijo Thomas
9,737 Points

Multiline string literals are a new feature that's supported in Swift 4 not Swift 3. Here's the Apple documentation

Kavita Bargota
Kavita Bargota
2,741 Points

Hi there, I am doing the beginners ios course and reading/following the documents attached which are Swift 4. I didnt realise this until some code I was inputting onto Xcode 8 was coming up as errors (forgive me i am completely new to this).

Are there any tutorials on Swift 4 on Treehouse? I am getting a little confused with everything at the moment...

I have Xcode 8, learning Swift 3 on treehouse but following and practice Apples Swift 4 guidance.....is this wrong? Should I be using xcode 9 and continue practicing as per Apples guidance Swift 4?

Also would Treehouse Swift 3 video tutorials still be appropriate? (sorry its obvious but I am new to this and have no idea)

thanks

Kavita