2021年3月13日 星期六

[Swift]取得檔案夾下的所有檔案名稱

透過以下方式可以取得FileManager搜尋程式中的檔案


let manager = FileManager.default

let urlForDocument = manager.urls(for: .documentDirectory, in:.userDomainMask)

let finalurl = urlForDocument.first! as URL

let contentsOfPath = try? manager.contentsOfDirectory(atPath: finalurl.path)

print("contentsOfPath: \(contentsOfPath)")




此段程式搜尋.documentDirectory,也可以搜尋程式下的.libraryDirectory

[SwiftUI] 暗黑模式設定

透過以下方法可以設定程式的暗黑模式




var body: some Scene {

        WindowGroup {

            ContentView().preferredColorScheme(.light)

        }    

    }




如果設定.light的話底色是白色的背景可能還需要設定Status Bar Style 
否則狀態欄中的一些基本資訊可能會看不到


Privacy Policy-雙五角測驗

   『 Privacy Policy 』 ichizawa built the 雙五角測驗 app as a Free app. This SERVICE is provided by ichizawa  it will not collect any of your pers...