csvファイルからデータを読み込む方法
func loadCSV(fileName: String) -> [String] { var dataArray: [String] = [] if let csvBundle = Bundle.main.path(forResource: fileName, ofType: "csv") { do { let csvData = try String(contentsOfFile: csvBundle,encoding: .utf8) dataArray = csvData.components(separatedBy: "\n") dataArray.removeLast() } catch { print("エラー") } } return dataArray }