Skip to content

Instantly share code, notes, and snippets.

View ryanlintott's full-sized avatar

Ryan Lintott ryanlintott

View GitHub Profile
@ryanlintott
ryanlintott / ListWithMoveUpAction.swift
Last active May 25, 2023 21:47
A list of items with accessibility action to move an item up.
struct ListWithMoveUpAction: View {
@AccessibilityFocusState private var focus: String?
@State private var users = ["Glenn", "Malcolm", "Nicola", "Terri"]
var body: some View {
NavigationStack {
List(users, id: \.self) { user in
Text(user)
.accessibilityActions {
Button {
@ryanlintott
ryanlintott / PagedSelectableView.swift
Created January 12, 2023 19:11
Draggable paged views where clicking the focused view triggers an action and clicking any other view scrolls to that view.
//
// PagedSelectableView.swift
// FrameUpExample
//
// Created by Ryan Lintott on 2023-01-12.
//
import SwiftUI
struct PagedSelectableView: View {
@ryanlintott
ryanlintott / JustifiedTextExample2.swift
Last active June 13, 2025 09:21
A way to justify text using a single SwiftUI Text view.
//
// JustifiedTextExample2.swift
// FrameUpExample
//
// Created by Ryan Lintott on 2022-11-15.
//
import SwiftUI
import WidgetKit
@ryanlintott
ryanlintott / DoubleScrollTabView.swift
Created November 14, 2022 06:43
A header that scrolls away, a sticky tab bar and two scrollviews that remember their position. A quick implementation made using FrameUp's SmartScrollView.
//
// DoubleScrollTabView.swift
// FrameUpExample
//
// Created by Ryan Lintott on 2022-11-13.
//
import FrameUp
import SwiftUI
@ryanlintott
ryanlintott / ShirtThatFits.swift
Created August 8, 2022 16:20
A SwiftUI view that uses ViewThatFits to present an SFSymbol tshirt that fits.
//
// ShirtThatFits.swift
// ShirtThatFits
//
// Created by Ryan Lintott on 2022-08-05.
//
import SwiftUI
enum Shirt: Int, RawRepresentable, CaseIterable, Identifiable, Hashable, Codable, View {
@ryanlintott
ryanlintott / TwoSidedView.swift
Created July 11, 2022 22:26
A two sided view that can be flipped with a drag gesture.
//
// TwoSidedView.swift
// FrameUpExample
//
// Created by Ryan Lintott on 2022-07-11.
//
import SwiftUI
struct TwoSidedView<UpContent: View, DownContent: View>: View {
@ryanlintott
ryanlintott / FlippableView.swift
Created July 11, 2022 19:30
A view that flips with a drag gesture.
//
// FlippableView.swift
// FrameUpExample
//
// Created by Ryan Lintott on 2022-07-11.
//
import SwiftUI
struct FlippableView: View {
@ryanlintott
ryanlintott / LayoutThatFits.swift
Last active December 8, 2023 15:14
An alternative to ViewThatFits. Updated version can be found here: https://github.com/ryanlintott/LayoutThatFits
//
// LayoutThatFits.swift
// WWDC22Experiments
//
// Created by Ryan Lintott on 2022-06-08.
//
import SwiftUI
struct LayoutThatFits: Layout {
@ryanlintott
ryanlintott / image-expansion.swift
Last active May 17, 2022 15:53 — forked from robb/image-expansion.swift
Image that can be revealed between other elements in a VStack.
import SwiftUI
struct ContentView: View {
@State private var pictureExpanded = false
var body: some View {
VStack(alignment: .leading, spacing: 20.0) {
Text("Once upon a time there was a turtle named George who made friends with a giraffe at the local water park and then they went on lots of adventures together.")
Button {
@ryanlintott
ryanlintott / InfoDictionary.swift
Last active April 5, 2022 22:51
RotationMatchingOrientationViewModifier
//
// InfoDictionary.swift
// FrameUp
//
// Created by Ryan Lintott on 2021-05-11.
//
import SwiftUI
struct InfoDictionary {