Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arrays 从文件swift 3读取数组[Struct]_Arrays_Swift_File_Struct - Fatal编程技术网

Arrays 从文件swift 3读取数组[Struct]

Arrays 从文件swift 3读取数组[Struct],arrays,swift,file,struct,Arrays,Swift,File,Struct,我有这个结构 struct Question { let answer : String let questionText : String } var questions = [Question]() 然后我有一个这个结构的数组 struct Question { let answer : String let questionText : String } var questions = [Question]() 如何从.txt文件中读取数组(因为我有300多行数组)

我有这个结构

struct Question {
  let answer : String
  let questionText : String
}
var questions = [Question]()
然后我有一个这个结构的数组

struct Question {
  let answer : String
  let questionText : String
}
var questions = [Question]()
如何从.txt文件中读取数组(因为我有300多行数组)


您应该使用json或plist文件,而不是txt@LeoDabus你能给我举个例子吗?