This file contains hidden or 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 UIKit | |
| public final class HostingView: UIView { | |
| public init(@ViewBuilder content: () -> some View) { | |
| super.init(frame: .zero) | |
| let contentView = UIHostingConfiguration(content: content) | |
| .margins(.all, 0) | |
| .makeContentView() |
This file contains hidden or 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
| // | |
| // ViewController.swift | |
| // UIMenu-Demo | |
| // | |
| // Created by Seb Vidal on 28/05/2024. | |
| // | |
| import UIKit | |
| class ViewController: UIViewController { |
This file contains hidden or 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
| blueprint: | |
| name: Philips Hue Dimmer switch v2 (Zigbee2MQTT) | |
| description: | |
| "Tested with Philips Hue Smart Wireless Dimmer Switch V2 (929002398602). | |
| \n\n | |
| Uses MQTT device triggers — select your dimmer from the device picker. | |
| \n\n | |
| After you pair a dimmer, press and release each of the four buttons, then hold and release each of them. | |
| Zigbee2MQTT publishes a device trigger to Home Assistant only after the device sends that action once, so this registers all 16 triggers. | |
| A short press sends `*_press` and `*_press_release`. A hold sends `*_press`, then `*_hold`, then `*_hold_release`. |
This file contains hidden or 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
| // | |
| // CodableInheritanceExample.swift | |
| // | |
| // Created by 홍경표 on 2021/05/28. | |
| // | |
| class BaseResponse: Codable { | |
| var retCode: Int = 0 | |
| private enum CodingKeys: String, CodingKey { |
This file contains hidden or 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 SwiftUI | |
| import UIKit | |
| struct DocumentPicker: UIViewControllerRepresentable { | |
| @Binding var filePath: URL? | |
| func makeCoordinator() -> DocumentPicker.Coordinator { | |
| return DocumentPicker.Coordinator(parent1: self) |
This file contains hidden or 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 | |
| public class CodableStorage { | |
| fileprivate init() { } | |
| enum Directory { | |
| case documents | |
| case caches | |
| case shared // Use for sharing files between containers. Eg, with an app extension. |
This file contains hidden or 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 UIKit | |
| public enum ColorSupport { | |
| public static var label: UIColor { | |
| if #available(iOS 13, *) { | |
| return .label | |
| } | |
| return UIColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 1.0) | |
| } |