Skip to content

Instantly share code, notes, and snippets.

View SwiftyAlex's full-sized avatar

Alex Logan SwiftyAlex

View GitHub Profile
@SwiftyAlex
SwiftyAlex / squishybuttonthing.swift
Created April 20, 2024 15:20
squishybuttonthing
// Credit to Raffi for the design! https://twitter.com/raffichill/status/1781492309500027206
struct SquishyButtonThing: View {
@State var expanded: Bool = false
var body: some View {
VStack {
Spacer()
VStack {
@SwiftyAlex
SwiftyAlex / whatnotview.swift
Last active February 18, 2023 18:21
lil animation ❤️
import SwiftUI
struct WhatNotView<
OffCircleContent: View,
OnCircleContent: View,
OffTrailingContent: View,
OnTrailingContent: View
>: View {
@State var toggle: Bool = false
@ScaledMetric var scale: CGFloat = 1
@SwiftyAlex
SwiftyAlex / CoffeePropertyQuery.swift
Created July 11, 2022 16:37
Coffee entity being queried
import Foundation
import AppIntents
public struct CoffeePropertyQuery: EntityPropertyQuery {
public init() { }
public func entities(for identifiers: [Coffee.ID]) async throws -> [Coffee] {
Coffee.all.filter({ identifiers.contains($0.id) })
}
@SwiftyAlex
SwiftyAlex / App.swift
Created March 5, 2022 17:22
TCA app make sure you have composable set
import SwiftUI
import Combine
import ComposableArchitecture
struct AppState: Equatable {
var count = 0
}
enum AppAction: Equatable {
case decrementButtonTapped
case incrementButtonTapped
//
// ContentView.swift
// Searchable
//
// Created by Alex Logan on 27/06/2021.
//
import SwiftUI
struct Coffee: Hashable {
@SwiftyAlex
SwiftyAlex / AsyncBrew.swift
Created June 7, 2021 22:14
Async brew fetching.
struct Coffee: Hashable {
let name: String
}
class CoffeeStore: ObservableObject {
func getCoffee() async -> [Coffee] {
Thread.sleep(forTimeInterval: 2)
return [
Coffee(name: "Cortado"),
Coffee(name: "Flat White")
@SwiftyAlex
SwiftyAlex / WelcomeView.swift
Created August 30, 2020 11:29
SwiftUI Welcome View
//
// WelcomeView.swift
// iOS
//
// Created by Alex Logan on 30/08/2020.
//
import SwiftUI
struct WelcomeView: View {
// Container View
struct SomeView: View {
var body: some View {
VStack {
Text("Welcome to our SwiftUI app")
.companyStyled()
FeaturedContentView()
ArticlesScrollView()
FooterView()
}
// Container View
struct SomeView: View {
var body: some View {
VStack {
Text("Welcome to our SwiftUI app")
.modifier(CompanyHeaderLabel())
FeaturedContentView()
ArticlesScrollView()
FooterView()
}
// Container View
struct SomeView: View {
var body: some View {
VStack {
Text("Welcome to our SwiftUI app")
.font(.custom("Montserrat-Bold", size: 16))
.foregroundColor(.textBlack)
.padding()
FeaturedContentView()
ArticlesScrollView()