Reading from txt file in Swift 3
问题 I want to know how to read from a txt file and print out specific parts of the file? For example, "test.txt" will contain: '''Jason 16 male self programing Josh 15 male friend art''' So I am looking for a way to print each word and line separately. Such as only printing: "Jason" "Jason is 16" "Josh likes art" This is what I got so far from searching around if let filepath = Bundle.main.path(forResource: "test", ofType: "txt") { do { let contents = try String(contentsOfFile: filepath) print