How to access file included in app bundle in Swift?

后端 未结 7 1886
灰色年华
灰色年华 2020-11-30 05:46

I know there are a few questions pertaining to this, but they\'re in Objective-C.

How can I access a .txt file included in my app using Swift on

7条回答
  •  时光取名叫无心
    2020-11-30 06:08

    Get File From Bundle in Swift 5.1

    //For Video File
    let stringPath = Bundle.main.path(forResource: "(Your video file name)", ofType: "mov")
    
    let urlVideo = Bundle.main.url(forResource: "Your video file name", withExtension: "mov")
    

提交回复
热议问题