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 PaginationModifier: ViewModifier { | |
let metadata: PaginationMetadata? | |
let onBottom: () -> Void | |
func body(content: Content) -> some View { | |
content | |
if let metadata, !metadata.isAtEnd, metadata.items != 0 { | |
VStack { | |
Text("Page \(metadata.page) of \(metadata.pages).") | |
Text("\(metadata.items) total items.") |
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
// | |
// URLSession+LinuxAsync.swift | |
// | |
// Created by Ayden Panhuyzen on 2022-11-27. | |
// | |
#if canImport(FoundationNetworking) | |
import Foundation | |
import FoundationNetworking |
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
version: 2 | |
root-markers: | |
- .git/ | |
lint-debounce: 1s | |
tools: | |
sh-shellcheck: &sh-shellcheck | |
lint-command: 'shellcheck -f gcc -x' | |
lint-source: 'shellcheck' | |
lint-formats: | |
- '%f:%l:%c: %trror: %m' |
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 ContentView: View { | |
@State var horizontal: Bool = true | |
@Namespace var namespace | |
var body: some View { | |
VStack(spacing: 40) { | |
if horizontal { | |
HStack { items } |
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 | |
import Combine | |
public struct ChangeObserver<V: Equatable>: ViewModifier { | |
public init(newValue: V, action: @escaping (V) -> Void) { | |
self.newValue = newValue | |
self.newAction = action | |
} | |
private typealias Action = (V) -> Void |
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 __ValueType__ { | |
} | |
struct __ValueType__Key: EnvironmentKey { | |
static var defaultValue = __ValueType__() | |
} | |
extension EnvironmentValues { | |
var __KeyName__: __ValueType__ { | |
get { |
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
// | |
// KeyCommand.swift | |
// Adds Keyboard Shortcuts to SwiftUI on iOS 13 | |
// See https://steipete.com/posts/fixing-keyboardshortcut-in-swiftui/ | |
// License: MIT | |
// | |
// Usage: (wrap view in `KeyboardEnabledHostingController`) | |
// Button(action: { | |
// print("Button Tapped!!") | |
// }) { |
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 ViewController: UIViewController { | |
@IBAction func onSearch(_ sender: Any) { | |
let fakeWindow = UIWindow(windowScene: view.window!.windowScene!) | |
let fakeTextField = UITextField() | |
fakeTextField.autocorrectionType = .no | |
fakeWindow.addSubview(fakeTextField) | |
fakeWindow.makeKeyAndVisible() | |
fakeTextField.becomeFirstResponder() |
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
extension DecodingError.Context { | |
var pathDescription: String { | |
pathDescription(for: codingPath) | |
} | |
func path(including final: CodingKey) -> String { | |
pathDescription(for: codingPath + [final]) | |
} | |
private func pathDescription(for path: [CodingKey]) -> String { |
NewerOlder