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 | |
private let linkDetector = try! NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue) | |
struct LinkColoredText: View { | |
enum Component { | |
case text(String) | |
case link(String, URL) | |
} |
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
// Run any SwiftUI view as a Mac app. | |
// Based on https://gist.github.com/chriseidhof/26768f0b63fa3cdf8b46821e099df5ff | |
import Cocoa | |
import SwiftUI | |
NSApplication.shared.run { | |
VStack(spacing: 0) { | |
Rectangle().fill(Color.green) | |
Rectangle().fill(Color.yellow) |