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 SwiftUI | |
import Observation | |
@propertyWrapper | |
struct EnvironmentObservable<Value: AnyObject & Observable>: DynamicProperty { | |
@Environment var wrappedValue: Value | |
public init(_ objectType: Value.Type) { | |
_wrappedValue = .init(objectType) |
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 SwiftUI | |
enum OSDocumentError: Error { | |
case unknownFileFormat | |
} | |
#if canImport(UIKit) | |
import UIKit |
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
// | |
// Watchdog.swift | |
// | |
// The MIT License (MIT) | |
// Copyright © 2023 Front Pocket Software LLC | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | |
// documentation files (the “Software”), to deal in the Software without restriction, including without limitation the | |
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to | |
// permit persons to whom the Software is furnished to do so, subject to the following conditions: |
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
extension Sequence { | |
func asyncMap<T>(_ transform: @escaping (Element) async -> T) async -> [T] { | |
return await withTaskGroup(of: T.self) { group in | |
var transformedElements = [T]() | |
for element in self { | |
group.addTask { | |
return await transform(element) | |
} | |
} |
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
/** | |
* MacEditorTextView | |
* Copyright (c) Thiago Holanda 2020-2021 | |
* https://twitter.com/tholanda | |
* | |
* MIT license | |
* Modified by https://github.com/cjwcommuny for TextKit 2 | |
*/ | |
import Combine |
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 Combine | |
public enum AnyError: Error { | |
case never(Never) | |
case failure(Error) | |
} | |
public enum AnyEvent { | |
case output(Any) | |
case completion(Subscribers.Completion<AnyError>) |
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
# Change Xcode version in GitHub Actions | |
As of today (2019-08-21) I haven't found any documentation on changing Xcode versions when | |
using GitHub actions. So I checked the applications folder and everything we need is | |
already there. 🤩 | |
``` | |
> ls -n /Applications/ | grep Xcode* | |
lrwxr-xr-x 1 0 80 30 Aug 2 19:31 Xcode.app -> /Applications/Xcode_10.2.1.app | |
drwxr-xr-x 3 501 20 96 Oct 20 2018 Xcode_10.1.app |
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 Foundation | |
import CommonCrypto | |
extension Data { | |
enum Algorithm { | |
case md5 | |
case sha1 | |
case sha224 | |
case sha256 | |
case sha384 |
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
/// Verify the signature passed with the Paddle request parameters. | |
/// Details here: https://paddle.com/docs/reference-verifying-webhooks | |
func verifyPaddleSignature(inParameters parameters: [String:String]) throws -> Bool { | |
guard let signatureString = parameters[PaddleParameter.signature.rawValue], | |
let signature = Data(base64Encoded: signatureString) else { | |
return false | |
} | |
// Need to gather sorted parameters | |
var signatureParameters = parameters |
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 Foundation | |
class MyService: NSObject, MyServiceProtocol { | |
func upperCaseString(_ string: String, withReply reply: @escaping (String) -> Void) { | |
let response = string.uppercased() | |
reply(response) | |
} | |
} |
NewerOlder