基本上,我试图用Swift 3做到这一点:
write a titleString to file
For i=1 to n
newString = createNewString() //these may look like "1: a, b, c"
append each new string to end of file
next i
Run Code Online (Sandbox Code Playgroud)
这是我做的:
let fileURL = URL(fileURLWithPath: completePath)
let titleString = "Line, Item 1, Item 2, Item 3"
var dataString: String
let list1 = [1, 2, 3, 4, 5]
let list2 = ["a", "b", "c", "d", "e"]
let list3 = ["p", "q", "r", "s", "t"]
for i in 0...4 { …Run Code Online (Sandbox Code Playgroud)