How to get path to a subfolder in main bundle?

后端 未结 3 448
Happy的楠姐
Happy的楠姐 2020-12-19 00:53

I have a project which I am migrating from Obj-C to Swift 3.0 (and I am quite a noob in Swift).

How do I translate this line?

NSString *folder = [[[N         


        
3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-19 01:29

    You can use this method to get listing of the bundle subdirectory and get resources only of the specific type:

    Bundle.main.paths(forResourcesOfType: type, inDirectory: folder)
    

提交回复
热议问题