File
public struct File : CustomStringConvertible
A Swift file
-
Creates a File instance which represents a Swift file that will be created
Declaration
Swift
@inlinable public init(name: String, indent: String, @CodeBuilder body: () -> CodeRepresentable)Parameters
nameThe name of the Swift file to be created
indentThe string used as indent characters. Should only be whitespace
bodyThe Swift code that represents the body of the file
-
The name of the Swift file
Declaration
Swift
public let name: String -
The string used for indenting Swift code
Declaration
Swift
public let indent: String -
The current date at the creation of this instance
Declaration
Swift
public let date: Date -
The body of the Swift file
Declaration
Swift
public let code: Code
-
Declaration
Swift
public var description: String { get } -
A String representation of the File’s code content
Declaration
Swift
public var string: String { get }
-
Creates/overwrites a Swift file at the given path. Throws if there is an error encountered during the I/O operation
Declaration
Swift
@inlinable public func write(to pathString: String = "") throwsParameters
pathStringThe string representation of a file path. For example “~/Downloads”
View on GitHub
Install in Dash
File Structure Reference