brightdigit.com
517.325.3123
var serialNumber: String? { | |
let platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice") ) | |
guard platformExpert > 0 else { | |
return nil | |
} | |
guard let serialNumber = (IORegistryEntryCreateCFProperty(platformExpert, kIOPlatformSerialNumberKey as CFString, kCFAllocatorDefault, 0).takeUnretainedValue() as? String)?.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) else { | |
return nil | |
} |
#!/bin/bash | |
# Define Swift Package Dependencies | |
dependencies=( | |
"Vapor:https://github.com/vapor/vapor.git:4.66.0" | |
"Fluent:https://github.com/vapor/fluent.git:4.0.0" | |
"FluentPostgresDriver:https://github.com/vapor/fluent-postgres-driver.git:2.0.0" | |
"JWT:https://github.com/vapor/jwt.git:5.0.0-beta.1" | |
"AsyncAlgorithms:https://github.com/apple/swift-async-algorithms:1.0.0" | |
"OpenAPIVapor:https://github.com/swift-server/swift-openapi-vapor:1.0.0" |
#!/bin/bash | |
# Check if input file is provided | |
if [ $# -ne 1 ]; then | |
echo "Usage: $0 <input_file.swift>" | |
exit 1 | |
fi | |
input_file="$1" | |
output_file="${input_file%.swift}_cleaned.swift" |
brightdigit.com
517.325.3123
#!/bin/bash | |
SOURCE_DIR="/path/to/your/source/directory" | |
find "$SOURCE_DIR" -name "*.swift" -type f -print0 | while IFS= read -r -d '' file; do | |
# Create a temporary file for editing | |
tmp_file=$(mktemp) | |
# Use awk to perform the replacement and save to the temporary file | |
awk ' |
// | |
// FileManager+ReduceDirectory.swift | |
// Copyright (c) 2023 BrightDigit. | |
// | |
import Foundation | |
private extension Error where Self == NSError { | |
static func fileNotFound(at url: URL) -> NSError { | |
NSError( |
// | |
// PreferredLayoutView.swift | |
// Copyright (c) 2023 BrightDigit. | |
// | |
#if canImport(SwiftUI) | |
import Foundation | |
import SwiftUI | |
public struct Value<Value> { |
import AppKit | |
import SwiftUI | |
// .onCloseButton(self.$object.delegate, { _ in | |
// self.object.presentConfirmCloseAlert = true | |
// return false | |
// }) | |
class NSWindowDelegateAdaptor: NSObject, NSWindowDelegate { | |
internal init(onWindowShouldClose: ((NSWindow) -> Bool)?) { |
// | |
// NSWindowAdaptorModifier.swift | |
// Copyright (c) 2023 BrightDigit. | |
// | |
import AppKit | |
import Foundation | |
import SwiftUI | |
// swiftlint:disable strict_fileprivate |
// swift-tools-version: 5.9 | |
// The swift-tools-version declares the minimum version of Swift required to build this package. | |
// add this to beginning of your Package.swift | |
import PackageDescription | |
// MARK: SupportedPlatform | |
protocol SupportedPlatformable { |