import Foundation public extension Array { /// Safely retrieves the object at the specified index. /// /// This method is a safer alternative to direct subscripting, as it /// returns `nil` instead of crashing if the index is out of bounds. /// /// - Parameter index: The index of the object to retrieve. /// - Returns: The object at the specified index, or `nil` if the index is out of bounds. func object(at index: Int) -> Element? { fatalError() } /// Removes the first object from the array. /// This is a mutating function that modifies the array in place. /// If the array is empty, this method does nothing. mutating func removeFirstObject() { fatalError() } } public extension Array where Element == String { /// Checks if the array contains a specific string, ignoring case. /// /// - Parameter string: The string to search for. /// - Returns: `true` if any element in the array matches the string case-insensitively, otherwise `false`. func containsStringIgnoringCase(_ string: String) -> Bool { fatalError() } /// Returns a new array with leading and trailing whitespace and newlines trimmed from each string element. /// /// - Returns: A new array containing the trimmed strings. func arrayWithTrimmedStrings() -> [String] { fatalError() } } public extension Data { /// Attempts to decode the Data into a UTF-8 formatted string. /// - Returns: A String if the data is valid UTF-8, otherwise `nil`. var utf8String: String? { fatalError() } /// Attempts to parse the Data as a JSON object. /// /// This is a convenient shortcut for `JSONSerialization`. /// /// - Returns: A dictionary representing the JSON object, or `nil` if parsing fails. func toJSONObject() -> [String: Any]? { fatalError() } /// Attempts to parse the Data as a JSON array. /// /// - Returns: An array representing the JSON array, or `nil` if parsing fails. func toJSONArray() -> [Any]? { fatalError() } } public extension Date { /// Checks if this date is later than another date. /// - Parameter date: The date to compare against. /// - Returns: `true` if this date is after the specified date, otherwise `false`. func isLater(than date: Date) -> Bool { fatalError() } /// Checks if this date is earlier than another date. /// - Parameter date: The date to compare against. /// - Returns: `true` if this date is before the specified date, otherwise `false`. func isEarlier(than date: Date) -> Bool { fatalError() } /// Checks if this date is the same as another date. /// - Parameter date: The date to compare against. /// - Returns: `true` if this date is exactly the same as the specified date, otherwise `false`. func isSame(as date: Date) -> Bool { fatalError() } /// Returns a formatted string representation of the date. /// /// This provides a simple way to get a common string format without needing to /// instantiate a DateFormatter every time. /// /// - Parameter dateStyle: The style for the date component. /// - Parameter timeStyle: The style for the time component. /// - Returns: A formatted string (e.g., "Sep 3, 2025 at 10:30 AM"). func formatted(dateStyle: DateFormatter.Style, timeStyle: DateFormatter.Style) -> String { fatalError() } /// A convenience property for the ISO8601 standard format, widely used in APIs. /// - Returns: A string in ISO8601 format (e.g., "2025-09-03T10:30:00Z"). var iso8601: String { fatalError() } /// A convenience property for a medium-style time string (e.g., "3:30:32 PM"). /// This is a backward-compatible alternative to the newer `.formatted()` API. var standardTime: String { fatalError() } } /// A global computed property that checks if the verbose logging flag is enabled. /// This is controlled by setting an environment variable in the Xcode scheme's "Run" action. public var isVerboseLoggingEnabled: Bool { fatalError() } public extension Dictionary { /// Checks if a key exists in the dictionary. /// This can be more expressive than checking `dictionary[key] != nil`. /// /// - Parameter key: The key to check for. /// - Returns: `true` if the key exists in the dictionary, otherwise `false`. func hasKey(_ key: Key) -> Bool { fatalError() } } public extension FileManager { /// Checks if a file or directory exists at the specified path. /// - Parameter path: The path to check. /// - Returns: `true` if an item exists at the path, otherwise `false`. static func itemExists(atPath path: String) -> Bool { fatalError() } /// Checks if an item at the specified path is a directory. /// - Parameter path: The path to check. /// - Returns: `true` if a directory exists at the path, otherwise `false`. static func isDirectory(atPath path: String) -> Bool { fatalError() } /// Checks if an item at the specified path is a file. /// - Parameter path: The path to check. /// - Returns: `true` if a file exists at the path, otherwise `false`. static func isFile(atPath path: String) -> Bool { fatalError() } /// Checks if a file or directory exists at the specified URL. /// - Parameter url: The URL to check. /// - Returns: `true` if an item exists at the URL, otherwise `false`. static func itemExists(at url: URL) -> Bool { fatalError() } /// Checks if an item at the specified URL is a directory. /// - Parameter url: The URL to check. /// - Returns: `true` if a directory exists at the URL, otherwise `false`. static func isDirectory(at url: URL) -> Bool { fatalError() } /// Checks if an item at the specified URL is a file. /// - Parameter url: The URL to check. /// - Returns: `true` if a file exists at the URL, otherwise `false`. static func isFile(at url: URL) -> Bool { fatalError() } /// Safely creates a directory at the specified path, including any necessary intermediate directories. /// - Parameter path: The full path of the directory to create. /// - Returns: `true` if the directory was created successfully or already existed, otherwise `false`. @discardableResult static func createDirectory(atPath path: String) -> Bool { fatalError() } /// Safely creates a directory at the specified URL, including any necessary intermediate directories. /// - Parameter url: The full URL of the directory to create. /// - Returns: `true` if the directory was created successfully or already existed, otherwise `false`. @discardableResult static func createDirectory(at url: URL) -> Bool { fatalError() } } public extension NSNumber { /// A boolean value indicating whether the NSNumber is representing a floating-point type (Float or Double). /// /// This is useful for determining how to handle a generic NSNumber object. var isFloatOrDouble: Bool { fatalError() } /// A boolean value indicating whether the NSNumber is representing an integer type. var isInteger: Bool { fatalError() } } public struct PreferencesManager: Sendable { /// The shared singleton instance. public static let shared = PreferencesManager() /// Sets a value for a given key in UserDefaults. /// - Parameters: /// - value: The value to store. Can be any property list object (String, Int, Data, etc.). /// - key: The key to associate with the value. public func set(_ value: Any?, for key: String) { fatalError() } /// Retrieves a String value for a given key. /// - Parameter key: The key for the desired value. /// - Returns: The String value, or `nil` if the key does not exist or the value is not a String. public func get(for key: String) -> String? { fatalError() } /// A generic getter for other types, though string is most common. public func getValue(for key: String) -> T? { fatalError() } /// Removes a value for a given key. /// - Parameter key: The key of the value to remove. public func remove(for key: String) { fatalError() } /// Checks if a value exists for a given key. /// - Parameter key: The key to check. /// - Returns: `true` if a value exists, `false` otherwise. public func hasValue(for key: String) -> Bool { fatalError() } } /// Executes a Swift script string and returns the merged output and exit code. /// - Parameters: /// - script: The unescaped Swift script source code. /// - arguments: CLI parameters passed to the script. /// - workingDirectory: Optional working directory for execution. /// - autoLinkSharedBinaries: If true, automatically injects framework search paths from SHARED_BINARIES/FACTORY_HOME. /// - Returns: A tuple containing the merged stdout/stderr output and the process exit code. @discardableResult public func runSwift( script: String, arguments: [String] = [], workingDirectory: String? = nil, autoLinkSharedBinaries: Bool = true ) -> (output: String, exitCode: Int32) { fatalError() } /// Executes a Python script string and returns the merged output and exit code. /// - Parameters: /// - script: The unescaped Python script source code. /// - arguments: CLI parameters passed to the script. /// - workingDirectory: Optional working directory for execution. /// - Returns: A tuple containing the merged stdout/stderr output and the process exit code. @discardableResult public func runPython( script: String, arguments: [String] = [], workingDirectory: String? = nil ) -> (output: String, exitCode: Int32) { fatalError() } public let warezHome: String = "" public func log(_ message: String, to logFileBaseName: String, verbose: Bool = false) { fatalError() } @discardableResult public func runCommand(launchPath: String, arguments: [String], workingDirectory: String? = nil) -> (output: String, exitCode: Int32) { fatalError() } /// Executes an AppleScript command string and returns the result. /// - Parameter script: The AppleScript command to execute. /// - Returns: A tuple containing the script's output (trimmed of newlines) and its exit code. @discardableResult public func runAppleScript(script: String) -> (output: String, exitCode: Int32) { fatalError() } /// Extends the `Sequence` protocol to provide a convenient method for filtering out duplicate elements. /// /// This is particularly useful for combining arrays and ensuring that each unique element appears only once, /// while preserving the order of the first appearance. /// /// - Returns: An array containing only the unique elements from the original sequence, in their first-seen order. public extension Sequence where Element: Hashable { func unique() -> [Element] { fatalError() } } /// A diagnostic tool for Factory Apps to verify they are dynamically linking /// against the pre-compiled framework binaries at runtime. public func verifyStreamlineBinary() { fatalError() } public extension String { /// Checks if the string contains only numeric characters (0-9). /// - Returns: `true` if the string is purely numeric, otherwise `false`. var isNumeric: Bool { fatalError() } /// Returns a new string made by removing leading and trailing whitespace and newline characters. /// This is a more convenient version of the built-in `trimmingCharacters(in:)`. var trimmed: String { fatalError() } /// Performs a case-insensitive comparison to see if the string contains a given substring. /// - Parameter substring: The string to search for. /// - Returns: `true` if the substring is found, otherwise `false`. func containsIgnoringCase(_ substring: String) -> Bool { fatalError() } /// A convenience alias for `containsIgnoringCase`. func isCaseInsensitiveLike(_ substring: String) -> Bool { fatalError() } /// Returns the character at a specific integer index. /// Returns `nil` if the index is out of bounds. /// - Parameter index: The integer index of the character. /// - Returns: The `Character` at the specified position, or `nil`. func character(at index: Int) -> Character? { fatalError() } /// Returns a new string containing the characters of the receiver from the one at a given index to the end. /// - Parameter index: The starting index. /// - Returns: A new string, or an empty string if the index is out of bounds. func substring(from index: Int) -> String { fatalError() } /// Returns a new string containing the characters of the receiver up to the one at a given index. /// - Parameter index: The ending index (not included in the result). /// - Returns: A new string, or the full string if the index is out of bounds. func substring(to index: Int) -> String { fatalError() } } public func TrimWhiteSpace(_ string: String) -> String { fatalError() } public extension URL { /// Splits a URL into its domain, path, and query components for factory use. /// - Returns: A tuple containing the domain, path, and an optional query, or nil if components are missing. func splitForFactory() -> (domain: String, path: String, query: String?)? { fatalError() } }