| 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:
| /** | |
| * I needed a property wrapper that fulfilled the following four requirements: | |
| * | |
| * 1. Values are stored in UserDefaults. | |
| * 2. Properties using the property wrapper can be used with SwiftUI. | |
| * 3. The property wrapper exposes a Publisher to be used with Combine. | |
| * 4. The publisher is only called when the value is updated and not | |
| * when_any_ value stored in UserDefaults is updated. | |
| * | |
| * First I tried using SwiftUI's builtin @AppStorage property wrapper |
| // | |
| // Settings.swift | |
| // Settings | |
| // | |
| // Created by Jordan Singer on 2/20/21. | |
| // | |
| import SwiftUI | |
| struct Settings: View { |
| import SwiftUI | |
| enum PreviewProviderMode: CaseIterable { | |
| /// Use for a light appearance preview. | |
| case lightMode | |
| /// Use for a dark appearance preview. | |
| case darkMode | |
| # example of a custom lldb command that prints Data as String | |
| # store in your home (~) directory | |
| command regex printData 's/(.+)/expr print(String(data: %1, encoding: .utf8))/' |
| xcrun simctl --set testing list | grep Booted | grep Clone | sed 's/^.*(\([A-Z0-9\-]*\)).*$/\1/g' | xargs -I {} xcrun simctl --set testing shutdown "{}" |
| import UIKit | |
| @propertyWrapper | |
| struct Printer<T> { | |
| public var currentValue: T? | |
| var wrappedValue: T? { | |
| get { | |
| print("Property wrapper value printed", currentValue) |
| /// - We have multiple files with a X amount of chunks | |
| /// - Each batch request can contain a max of 50 chunks from possibly multiple files | |
| /// | |
| /// Challenge: Distribute the chunk requests over as less batch requests as possible | |
| import UIKit | |
| import Foundation | |
| typealias PublicIdentifier = String |
I found that the "best" way is to use HTML, as it works both in Readme/.md files and also in comments (within Issues, Gist...)
E.g. when adding/editing a comment (within Issues, Gist...) :
 with <img src="https://your-image-url.type" width="100" height="100">As mentioned by @cbestow (thanks!), it's not mandatory to set both width and height. If only one is set, the other will be adjusted accordingly to preserve the aspect ratio of the image.