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
| // | |
| // CarouselInfinite.swift | |
| // IOS18Playground | |
| // | |
| // Created by Codelaby on 28/9/24. | |
| // | |
| // based: https://www.youtube.com/watch?v=p1nN9eFOPNQ | |
| 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
| fileprivate struct InfiniteScrollHelper: UIViewRepresentable { | |
| @Binding var contentSize: CGSize | |
| @Binding var declarationRate: UIScrollView.DecelerationRate | |
| func makeCoordinator() -> Coordinator { | |
| Coordinator(declarationRate: declarationRate, contentSize: contentSize) | |
| } | |
| func makeUIView(context: Context) -> some UIView { | |
| let view = UIView(frame: .zero) | |
| view.backgroundColor = .clear |
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 | |
| // MARK: InfiniteScrollView | |
| struct InfiniteScrollView<Content: View>: View { | |
| @State private var scrollPosition: ScrollPosition = ScrollPosition(idType: Int.self) | |
| @Binding var currentIndex: Int | |
| var spacing: CGFloat = 10 | |
| var itemSize: CGSize | |
| var count: Int = 0 |
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 | |
| // https://x.com/_take_hito_/status/1890677320895066252 | |
| struct ContentView: View { | |
| var body: some View { | |
| WavingText() | |
| .foregroundStyle(.white) | |
| .frame(maxWidth: .infinity, maxHeight: .infinity) | |
| .background(Color(hue: 220/360, saturation: 0.3, brightness: 0.9)) | |
| } |
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 | |
| struct DotPosition: Equatable, Hashable { | |
| let row: Int | |
| let column: Int | |
| } | |
| struct DotGridView: 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) |
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
| // | |
| // 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
| 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 |