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 / AnimatedHeartDemo.swift
Last active February 9, 2020 00:19
Demonstrates animating points in a path in PureSwiftUI
//
// AnimatedHeartDemo.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 / RainIconAnimationDemo.swift
Last active February 17, 2020 21:39
Demonstrates animating a layout guide to create a rain cloud icon
//
// RainIconDemo.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 / UpArrowToTickAnimatedIconDemo.swift
Created February 17, 2020 18:54
Demonstrates animating a layout guide and points within the layout guide
//
// UpArrowToTickAnimatedIconDemo.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 February 19, 2020 14:50
Demonstrates referring to points from one animated layout guide to another animated layout guide
//
// 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 / MyFitnessPalAddAnimation.swift
Created May 17, 2020 21:26
Code for CodeSlicing episode creating the add animations in MyFitnessPal
//
// MyFitnessPalAddAnimation.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 / BarChartAnimated.swift
Created June 28, 2020 21:16
Animated bar chart showing how layout guides can be used to facilitate animation of rectangles
//
// BarChartAnimated.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 / SwiftUIIconMatchedGeometryEffectSimplifiedBetterDelay.swift
Last active July 18, 2020 23:15
Uses matchedGeometryEffect to drag swifts between icons - emphasis is trying to recreate as accurately as possible the SwiftUI icon as a way of demonstrating using this modifier with multiple views with delays on animations (Xcode 12 required)
//
// SwiftUIIconMatchedGeometryEffectSimplifiedBetterDelay.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 / SwiftUIIconMatchedGeometryEffectSimplifiedBetterDelay.swift
Created July 18, 2020 21:16
Simplified version of the SwiftUI icon gist where the emphasis is on matchedGeometryEffect rather than recreating the SwiftUI icon to demonstrate the use of this modifier with multiple views and delays on the animations (Xcode 12 required)
//
// SwiftUIIconMatchedGeometryEffectSimplifiedBetterDelay.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 / 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
@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