func getTextFileStr(filename:String!) -> String! {
        if let path = Bundle.main.path(forResource: filename, ofType: "txt") {
            do {
                let data = try String(contentsOfFile: path, encoding: .utf8)
                return data
            } catch {
                print(error)
            }
        }
        return ""
    }

方法有些简单,就是这么简单。

相关文章:

  • 2022-12-23
  • 2021-12-12
  • 2021-12-13
  • 2021-08-02
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-25
  • 2021-09-04
  • 2022-12-23
相关资源
相似解决方案