Skip to content

Instantly share code, notes, and snippets.

View CodeSlicing's full-sized avatar
😎
Busy feeling awesome

CodeSlicing

😎
Busy feeling awesome
View GitHub Profile
@CodeSlicing
CodeSlicing / StickyTogglePhase1.swift
Last active December 26, 2020 10:16
Source for part 1 of large sticky toggles CodeSlicing episode
//
// StickyTogglePhase1.swift
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
@CodeSlicing
CodeSlicing / ContinuousStarRating.swift
Created December 6, 2020 16:49
Demonstrates using relative offset on mask to control visibility of masked star rating so the color is continuous behind the stars rather than on or off for each one
//
// ContinuousStarRating.swift
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
@CodeSlicing
CodeSlicing / SettingsIcon.swift
Created December 5, 2020 08:22
Code for the Settings icon
//
// SettingsIcon.swift
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
@CodeSlicing
CodeSlicing / AnimatedTrainWheelDemo.swift
Created November 21, 2020 14:44
Animated Train Wheel demo using layout guides for PureSwiftUI v2.0.0+
//
// AnimatedTrainWheelDemo.swift
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
@CodeSlicing
CodeSlicing / ChromeIcon.swift
Created November 15, 2020 11:13
Chrome Icon source which is compatible with PureSwiftUI v2.0.1+ (or PureSwiftUITools v2.0.1+)
//
// ChromeIcon.swift
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
@CodeSlicing
CodeSlicing / BreatheAnimation.swift
Last active September 17, 2021 10:54
Final version of the Breathe animation created on CodeSlicing: https://youtu.be/KUvkJOhpB9A
//
// BreatheAnimation.swift
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
@CodeSlicing
CodeSlicing / KeepPositionOnRotation.swift
Created August 5, 2020 23:23
Shows and example of maintaining the position of an overlay using offsets
//
// KeepPositionOnRotation.swift
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
@CodeSlicing
CodeSlicing / AnimeStyleChatDemo.swift
Last active August 3, 2020 07:51
Demo showing anime inspired chat bubbles, completely in SwiftUI. Requires Xcode 12 and PureSwiftUI 2.0.0-beta-1
//
// AnimeStyleChatDemo.swift
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
@CodeSlicing
CodeSlicing / GeometryReaderGreedyViewDemo.swift
Created July 20, 2020 21:43
View showing how to use GeometryReader with a greedy view. A companion file to CodeSlicing: CoreConcepts in SwiftUI - GeometryReader
import SwiftUI
import PureSwiftUI
private let size: CGFloat = 200
private let numLayers = 20
private let stepSize = 25
struct GeometryReaderGreedyViewDemo: View {
@State private var animating = false
@CodeSlicing
CodeSlicing / GeometryReaderProblemDemo.swift
Created July 20, 2020 21:42
View showing the problem that occurs when using GeometryReader with a non-greedy view. A companion file to CodeSlicing: CoreConcepts in SwiftUI - GeometryReader
import SwiftUI
import PureSwiftUI
private let size: CGFloat = 200
private let gradient = LinearGradient([Color.red, Color.yellow], to: .bottomTrailing)
struct GeometryReaderProblemDemo: View {
@State private var text = "Hello"
@State private var textSize: CGSize = .zero