Post

Replies

Boosts

Views

Activity

Reply to Add resources in Swift Playgrounds 4
The Resources folder should be automatically created when you add a resource file such as a sound file, or a CoreML model, and you don't need to modify the Package.swift file. To add files to your Resources folder, you can drag and drop them or go to File > Add File, and select your resource. If your question is how to add another folder that works as a resource folder, you can add it in the resources part of Package.swift like this: targets: [ .executableTarget( name: "AppModule", path: ".", resources: [ .process("Resources"), /* don't forget the comma */ .process("OtherFolder") // the folder you want to add as a resources folder (replace OtherFolder with the desired name) ] ) ] If you're asking how to edit the Package.swift file, I'm not sure if you can open it in Playgrounds. On macOS, you can right click on the App Playground > Show In Finder to get to its location, and then right click > show contents on the app to see the its files, including the Package.swift file. To use your resource files, you need to use something like let url = Bundle.main.url(forResource: "ResourceFile", withExtension: "txt") in combination with something else, depending on what you want to use it for.
Apr ’23
Reply to NavigationSplitView hide sidebar toggle button
You can use the toolbar(_:for:) modifier on your sidebar view like this: .toolbar(.hidden, for: .navigationBar). You can find details in the documentation here. Here's the resulting view: struct SomeView: View { var body: some View { NavigationSplitView( columnVisibility: .constant(.all), sidebar: { Text("sidebar") .toolbar(.hidden, for: .navigationBar) }, detail: { Text("detail") } ) .navigationSplitViewStyle(.balanced) } } The first argument sets the visibility, and the second arguments specifies which bar to hide (which in your case is .navigationBar).
Apr ’23