54f72a4c55e412a8a0b90485aa24bc54
SwiftUI Xcode 13 Product目录消失 如何获取app路径

实战问题

SwiftUI Xcode 13 Product目录消失 如何获取app路径

运行效果

SwiftUI Xcode 13 Product目录消失 如何获取app路径

SwiftUI Xcode 13 Product目录消失 如何获取app路径

解决方案

```
import SwiftUI

struct ContentView: View {
@State var docTxt = ""
@State var appTxt = ""
var body: some View {
Button("获取文档目录"){

        let documentDirectoryURL =  try! FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
        print(documentDirectoryURL)

       docTxt = "\(documentDirectoryURL)"
    }
   Text(docTxt)
top Created with Sketch.