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
| // | |
| // ContentView.swift | |
| // AnimationTimingCurve | |
| // | |
| // Created by Chris Eidhof on 25.09.19. | |
| // Copyright © 2019 Chris Eidhof. All rights reserved. | |
| // | |
| import SwiftUI |
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
| /// Renders `View` as `UIImage`. | |
| extension View { | |
| func snapshot(renderOnce: UnsafeMutablePointer<Bool>? = nil) -> UIImage? { | |
| if let flag = renderOnce, flag.pointee { | |
| return nil | |
| } | |
| renderOnce?.pointee = true | |
| let renderer = ImageRenderer(content: self) | |
| renderer.scale = UIScreen.main.scale |
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 | |
| // Simple example of a custom reordering implementation in SwiftUI | |
| struct ReorderableListExample: View { | |
| // Sample data | |
| @State private var items = ["Item 1", "Item 2", "Item 3", "Item 4", "Item 5"] | |
| @State private var isEditMode: EditMode = .inactive | |
| var body: some View { | |
| VStack { |
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
| // | |
| // FloatingOverlayApp.swift | |
| // FloatingOverlay | |
| // | |
| // Created by JuniperPhoton on 2025/3/12. | |
| // | |
| import SwiftUI | |
| // Dependency: https://github.com/sindresorhus/KeyboardShortcuts |
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
| class Stripes { | |
| static func stripedAngularGradient( | |
| _ colors: [Color], | |
| stripeCount: Int = 2, | |
| center: UnitPoint = .center, | |
| angle: Angle = .zero | |
| ) -> AngularGradient { | |
| let stripeWidth: CGFloat = 1.0 / CGFloat(stripeCount) | |
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 | |
| public struct Shimmer: AnimatableModifier { | |
| private let gradient: Gradient | |
| @State private var position: CGFloat = 0 | |
| public var animatableData: CGFloat { | |
| get { position } |
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
| struct AppearancePicker<SelectionValue, Content>: View where SelectionValue: Hashable & Sendable, Content: View { | |
| private var items: [SelectionValue] | |
| @Binding var selection: SelectionValue | |
| let content: (SelectionValue) -> Content | |
| // Public initializer | |
| init(items: [SelectionValue], selection: Binding<SelectionValue>, @ViewBuilder content: @escaping (SelectionValue) -> Content) { | |
| self.items = items | |
| self._selection = selection | |
| self.content = content |
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
| // | |
| // AppleBookScrollDemo.swift | |
| // IOS18Playground | |
| // | |
| // Created by Codelaby on 26/2/25. | |
| // | |
| import SwiftUI | |
| struct Book: Identifiable, Hashable, Sendable { |
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
| // | |
| // NumerciHPicker.swift | |
| // FieldsPlayground | |
| // | |
| // Created by Codelaby on 25/2/25. | |
| // | |
| import SwiftUI | |
| struct NumerciHPicker<SelectionValue, Content>: View where SelectionValue: Hashable & Sendable, Content: View { |
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
| // MARK: Slime Progress Dot Indicator | |
| struct SlimeProgressDotPageIndicator: View { | |
| private let currentPage: Int | |
| private let numberOfPages: Int | |
| private let hidesForSinglePage: Bool | |
| private let config: Config | |
| private let progress: CGFloat | |
| private var adjustedIndex: Int { | |
| return currentPage < 0 ? numberOfPages : (currentPage > numberOfPages ? 0 : currentPage) |