| name | explain-diff-html |
|---|---|
| description | Use when the user asks for a rich explanation of a code change, diff, branch, or PR. Produces HTML output. |
Please make me a rich, interactive explanation of the specified code change.
It should have these sections:
| public extension Task where Success == Void , Failure == Never { | |
| // Suspends until the task is cancelled | |
| static func cancellation() async -> Void { | |
| let s = AsyncStream<Void>{ continuation in } | |
| for await _ in s { | |
| } | |
| } | |
| // EMITS INFINITE ELEMENTS CPU 100% |
| @propertyWrapper | |
| public struct AllowDecodingFailures<T: Codable>: Codable { | |
| public var wrappedValue: [T] | |
| public var errors: [Error] | |
| public var projectedValue: AllowDecodingFailures<T> { self } | |
| private struct Empty: Decodable { } | |
| public init(wrappedValue: [T]) { | |
| self.init(wrappedValue: wrappedValue, errors: []) |
| // | |
| // NSApplication+NSResponderDebug.swift | |
| // | |
| // Created by Stephan Casas on 3/18/24. | |
| // | |
| import Cocoa; | |
| extension NSApplication { | |
| #!/usr/bin/env bash | |
| <% for type in types.classes { -%> | |
| <%_ if type.modifiers.map{ $0.name }.contains("final") || type.modifiers.map{ $0.name }.contains("open") || types.based[type.name].isEmpty == false { continue } -%> | |
| <%_ _%>git grep -lz 'class <%= type.name %>' | xargs -0 perl -i'' -pE "s/class <%= type.name %>(?=\s|:)/final class <%= type.name %>/g" | |
| <% } %> | |
| // Run with Sourcery on your codebase and then execute generated code via bash :) |
| import Foundation | |
| /// An Equatable container for storing and accessing just the attributes of an NSAttributedString without | |
| /// caring about the string itself. | |
| struct TextAttributes: Equatable { | |
| private var storage = NSMutableAttributedString(string: "") | |
| mutating func setAttributes(_ attributes: [NSAttributedString.Key: Any], range: NSRange) { | |
| preserveUniqueReferenceToStorageIfNecessary() | |
| extendStringRangeIfNecessary(range: range) |
| import Foundation | |
| protocol Placeholding { | |
| static func placeholder() -> Self | |
| } | |
| struct PlaceholderArray<Element: Placeholding>: RandomAccessCollection { | |
| typealias SubSequence = Slice<Self> | |
| var startIndex: Int { indices.lowerBound } |
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
| <plist version="1.0"> | |
| <dict> | |
| <key>FILEHEADER</key> | |
| <string> | |
| // Copyright © ___YEAR___ ___ORGANIZATIONNAME___. | |
| // All Rights Reserved. | |
| </string> | |
| <key>ORGANIZATIONNAME</key> |
| import Combine | |
| import SwiftUI | |
| extension View { | |
| public func focused<T>(file: StaticString = #file, _ state: FocusState<T>, equals value: T) -> some View { | |
| modifier(FocusedModifier(state: state, id: value, file: file)) | |
| } | |
| } | |
| @propertyWrapper |
| import ComposableArchitecture | |
| import Difference | |
| import Foundation | |
| /// A container for storing action filters. | |
| /// | |
| /// The logic behind having this rather than a normal closure is that it allows us to namespace and gather action filters together in a consistent manner. | |
| /// - Note: You should be adding extensions in your modules and exposing common filters you might want to use to focus your debugging work, e.g. | |
| /// ```swift | |
| /// extension ActionFilter where Action == AppAction { |