Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
James Lambert
Courses Plus Student 14,477 PointsWhy won't \n work in a string from a plist?
In swift, why is it that \n won't work when pulling a string from a plist to fill a UITextView?
3 Answers

James Lambert
Courses Plus Student 14,477 PointsI think it's because in the plist the data is Base-64 encoded and not Unicode

Myers Carpenter
6,421 PointsI don't think I follow your question. Could you give a small code example of your problem?

James Lambert
Courses Plus Student 14,477 PointsSure Thanks,
This creates the path and an instance of my array= var myPath = NSBundle.mainBundle().pathForResource("NameOfMyPlist", ofType: "plist") var myArray = NSArray(contentsOfFile: myPath!)
I then want to fill myTextFieldView with a string from the array= myTextFieldView.text = myArray![1] as String
This works and fills the text field view.
The only problem is that if the string in the array looks like "my first line\nmy second line" it should display: my first line my second line
Instead it displays: my first line\nmy second line