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! While you're at it, check out some resources Treehouse students have shared here.
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 trialJunaid Abd
Courses Plus Student 32 PointsHelp with array
How do I create an array of text with a waiting time between each cycle? Trying to achieve a result like this https://www.dropbox.com/s/tq66bn0b2tssn5i/Untitled.mp4?dl=0 ) Language- Swift
1 Answer
Jayden Spring
8,625 PointsRather than providing an answer, it would be more beneficial to understand one of the core pieces of swifts functionality. Have a read of this - it should help you understand Swfit Arrays
Junaid Abd
Courses Plus Student 32 PointsJunaid Abd
Courses Plus Student 32 PointsThanks, I definitely will. But can you give the answer for the moment because I need to use it in my WWDC scholarship app which I have to submit in about 3 hours
Jayden Spring
8,625 PointsJayden Spring
8,625 PointsArrays is a fundamental aspect to data collections in Swift.
I would suggest you understand the basics of Swift before attempting to create your scholarship applications as one of the things Apple look at is the code itself and what the application does.
The article I linked to shows you how to create arrays in many different ways as well as dictionaries.
Also replicating the link you showed me which I traced back to here (https://www.youtube.com/watch?v=InOeid6OQS0) will be quite hard if you are new to Swift & iOS in general. You may want to complete some tracks here over the next year, develop your skills and then by next year you should be able to create a neat functional application for WWDC2016 Scholarships.
Junaid Abd
Courses Plus Student 32 PointsJunaid Abd
Courses Plus Student 32 PointsI've read the documentation you gave me and done a bit more research (thanks again), how can I then keep adding words to the text field? So like how can I keep adding item ' i ' of the the array to the text field? (I've put 'sleep(1) ' )at the end of the loop so it'll give it the effect I'm looking for.
Jayden Spring
8,625 PointsJayden Spring
8,625 PointsThe kid who created that portfolio application built it on the back of a framework he developed which can be seen in his full video (not the framework itself). The way he has emulated a console to output text is quite neat - but you won't be able to achieve that with a text view.
If you are just trying to plonk lines of text and want them coming in one at a time you would need to set a timer for say a second and then every second add a line of text. So second 1 would be array element 0 and so on. Then when you reach the end of your array you stop the timer.