View CustomIntensityVisualEffectView.swift
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 UIKit | |
final class CustomIntensityVisualEffectView: UIVisualEffectView { | |
/// Create visual effect view with given effect and its intensity | |
/// | |
/// - Parameters: | |
/// - effect: visual effect, eg UIBlurEffect(style: .dark) | |
/// - intensity: custom intensity from 0.0 (no effect) to 1.0 (full effect) using linear scale | |
init(effect: UIVisualEffect, intensity: CGFloat) { | |
theEffect = effect |
View TimeZones.js
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
// Variables used by Scriptable. | |
// These must be at the very top of the file. Do not edit. | |
// icon-color: cyan; icon-glyph: clock; | |
// list of time zones: https://gist.github.com/rxaviers/8481876 | |
let configs = [ | |
{name: "Warsaw", timzeZone: "Europe/Berlin", bgColor: new Color("BF0D3E",1)}, | |
{name: "Recife", timeZone: "America/Recife", bgColor: new Color("009639",1)}, | |
{name: "Los Angeles", timeZone: "America/Los_Angeles", bgColor: new Color("3878d1",1)} | |
] |
View FormattedTextField.swift
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 | |
public struct FormattedTextField<Formatter: TextFieldFormatter>: View { | |
public init(_ title: String, | |
value: Binding<Formatter.Value>, | |
formatter: Formatter) { | |
self.title = title | |
self.value = value | |
self.formatter = formatter | |
} |
View SwiftUI_InterfaceOrientationObservingViewModifier.swift
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 InterfaceOrientationObservingViewModifier: ViewModifier { | |
let onChange: (UIInterfaceOrientation) -> Void | |
func body(content: Content) -> some View { | |
content.background(InterfaceOrientationObservingView(onChange: onChange)) | |
} | |
} |
View SwiftUI_DeviceOrientationObservingViewModifier.swift
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 CoreMotion | |
import SwiftUI | |
struct DeviceOrientationObservingViewModifier: ViewModifier { | |
let onChange: (UIDeviceOrientation) -> Void | |
func body(content: Content) -> some View { | |
content.background(DeviceOrientationObservingView(onChange: onChange)) | |
} | |
} |
View FetchedResultsPublisher.swift
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 Combine | |
import CoreData | |
public final class FetchedResultsPublisher | |
<ResultType> | |
: Publisher | |
where | |
ResultType: NSFetchRequestResult | |
{ | |
View App.swift
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
// Based on "Lazy navigation in SwiftUI" blogpost by Majid Jabrayilov | |
// Blogpost url: https://swiftwithmajid.com/2021/01/27/lazy-navigation-in-swiftui/ | |
// This gist shows an issue with using conditional NavigationLinks. | |
// When using StackNavigationViewStyle push animations are not present. | |
import SwiftUI | |
@main | |
struct LazyNavApp: App { | |
var body: some Scene { |
View SwiftUI_BottomBarViewModifier.swift
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 | |
extension View { | |
func bottomBar<Bar: View>( | |
ignoresKeyboard: Bool = true, | |
frameChangeAnimation: Animation? = .default, | |
@ViewBuilder bar: @escaping () -> Bar | |
) -> some View { | |
modifier(BottomBarViewModifier( | |
ignoresKeyboard: ignoresKeyboard, |
View SwiftUI_GeometryReaderViewModifier.swift
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 | |
extension View { | |
func geometryReader<Geometry: Codable>( | |
geometry: @escaping (GeometryProxy) -> Geometry, | |
onChange: @escaping (Geometry) -> Void | |
) -> some View { | |
modifier(GeometryReaderViewModifier( | |
geometry: geometry, | |
onChange: onChange |
NewerOlder