This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if a filename was provided | |
if [ $# -ne 1 ]; then | |
echo "Usage: $0 <filename>" | |
exit 1 | |
fi | |
filename=$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public protocol Database: Sendable { | |
func delete<T: PersistentModel>( | |
where predicate: Predicate<T>? | |
) async throws | |
func insert(_ closuer: @Sendable @escaping () -> some PersistentModel) async | |
func fetch<T, U : Sendable>( | |
_ selectDescriptor: @escaping @Sendable () -> FetchDescriptor<T>, | |
with closure: @escaping @Sendable ([T]) throws -> U |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AppKit | |
import ScriptingBridge | |
@objc public protocol SBObjectProtocol: NSObjectProtocol { | |
func get() -> Any! | |
} | |
@objc public protocol SBApplicationProtocol: SBObjectProtocol { | |
func activate() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 ' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// FileManager+ReduceDirectory.swift | |
// Copyright (c) 2023 BrightDigit. | |
// | |
import Foundation | |
private extension Error where Self == NSError { | |
static func fileNotFound(at url: URL) -> NSError { | |
NSError( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// PreferredLayoutView.swift | |
// Copyright (c) 2023 BrightDigit. | |
// | |
#if canImport(SwiftUI) | |
import Foundation | |
import SwiftUI | |
public struct Value<Value> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AppKit | |
import SwiftUI | |
// .onCloseButton(self.$object.delegate, { _ in | |
// self.object.presentConfirmCloseAlert = true | |
// return false | |
// }) | |
class NSWindowDelegateAdaptor: NSObject, NSWindowDelegate { | |
internal init(onWindowShouldClose: ((NSWindow) -> Bool)?) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSWindowAdaptorModifier.swift | |
// Copyright (c) 2023 BrightDigit. | |
// | |
import AppKit | |
import Foundation | |
import SwiftUI | |
// swiftlint:disable strict_fileprivate |
NewerOlder