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 | |
struct EdgeLines: Shape { | |
struct Edge: OptionSet { | |
static let top = Edge(rawValue: 1 << 0) | |
static let bottom = Edge(rawValue: 1 << 1) | |
static let left = Edge(rawValue: 1 << 2) | |
static let right = Edge(rawValue: 1 << 3) | |
static let all = Edge([.top, .bottom, .left, .right]) |
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
/// 多角形のシェープ. | |
struct Polygon : Shape { | |
/// 多角形の頂点の数. デフォルト値は`3` | |
var numberOfVertex: Int | |
/// 角の半径. デフォルト値は`3`. | |
var cornerRadius: CGFloat | |
/// 直線をトップに配置するかどうかのBool値. デフォルト値は`false`. |
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
/// Extended Range sRGB, 拡張範囲sRGBの構造体. | |
/// | |
/// ユーザーがカラーピッカーで選択した色を保存する際、 | |
/// 拡張sRGBに変換して取り回せばDisplay P3やAdobe RGBなどRGB系の別カラースペースの場合でも気にせず取り扱え便利なため中心的に利用する. | |
struct ExtendedSRGB: Hashable, Codable { | |
/// 負数と1以上の値も扱える赤の値. 0.0~1.0はsRGBと互換性がある。 | |
var red: CGFloat | |
/// 負数と1以上の値も扱える緑の値. 0.0~1.0はsRGBと互換性がある。 |
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
/// データをコミットすべきタイミングで実行されるModifier | |
/// | |
/// コミットされるタイミングは下記の3つ: | |
/// 1. `UIApplication.willTerminateNotification`通知を受け取ったとき | |
/// 2. `onDissapear`が呼び出されたとき | |
/// 3. `scenePhase`が`.background`に切り替わったとき | |
/// | |
/// このModifierは上記の3つをまとめて汎用的に取り扱えるシンタックスシュガーとなっている. | |
struct OnCommitModifier: ViewModifier { | |
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
/// UIKit製のUISplitViewController. | |
struct UIKitSplitView<Primary, Secondary>: UIViewControllerRepresentable where Primary : View, Secondary : View { | |
typealias UIViewControllerType = UISplitViewController | |
/// プライマリPaneのビューを生成するクロージャ | |
var primary: () -> Primary | |
/// セカンダリPaneのビューを生成するクロージャ | |
var secondary: () -> Secondary |
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
// | |
// UIKitTableView.swift | |
// | |
// Created by yosshi4486 on 2023/07/18. | |
// | |
import SwiftUI | |
private struct MoveActionEnvironmentKey: EnvironmentKey { | |
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
// | |
// BackForwardList.swift | |
// | |
// Created by yosshi4486 on 2023/04/02. | |
// | |
import Foundation | |
/// 進む・戻る管理の可能なリスト | |
/// |
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
// | |
// SynchronizingKeyValueStore.swift | |
// | |
// Created by yosshi4486 on 2022/08/30. | |
// | |
import Foundation | |
/// A key value store that stores a key-value into both local and cloud. Subclass this class and override methods for your application. | |
/// |
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
/// A class that checks and notifies an internect connectivity changes. | |
class NetworkConnectivityManager { | |
/// The static singleton instance. You can use this throught `NetworkConnectivityManager.shared`. | |
/// | |
/// Creating several manager instances doesn't make sense, so we design it as singleton. | |
static let shared = NetworkConnectivityManager() | |
/// The static notification name that the notification is post when a network status change. The object is [NWPath.Status](https://developer.apple.com/documentation/network/nwpath/status) | |
static let networkConnectivityDidChangeNotificationName = Notification.Name(rawValue: "_networkConnectivityDidChangeNotification") |
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
class CustomInputView: UIView, UIKeyInput { | |
private let label = UILabel() | |
override init(frame: CGRect) { | |
super.init(frame: frame) | |
label.tintColor = .label | |
label.font = .preferredFont(forTextStyle: .body, compatibleWith: nil) | |
label.text = "" |
NewerOlder