import Foundation /// A licence text that ships in the app bundle, by its file name in /// `Resources/Licenses`. /// /// The one place the app reads a licence into memory: the texts are the /// bundle's own, fixed at build, so their size is this app's and never a /// person's — which is the sentence `WholeBodySweepTests.allowedToBuffer` /// holds this file to. enum BundledLicence { static func contents(of name: String) -> String? { guard let url = Bundle.module.url(forResource: name, withExtension: "txt", subdirectory: "Licenses") else { return nil } return try? String(contentsOf: url, encoding: .utf8) } }