How can I read a file in a swift playground

后端 未结 9 1836
时光说笑
时光说笑 2020-12-12 22:37

Im trying to read a text file using a Swift playground with the following

let dirs : String[]? =    NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory         


        
9条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-12 23:01

    1. Select the .playground file.

    2. Open Utility inspector, In the playground press opt-cmd-1 to open the File Inspector. You should see the playground on the right. If you don't have it selected, press cmd-1 to open the Project Navigator and click on the playground file.

    3. Under 'Resource Path' in Playground Settings choose 'Relative To Playground' and platform as OSX.

提交回复
热议问题