A full example of adding String and AttributedString output to our custom types, as well as adding the ability to parse String values into your custom type.
This file contains hidden or 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 | |
| let width : CGFloat = 82.0 | |
| let height : CGFloat = 82.0 | |
| struct ContentView: View { | |
| @State private var toggle = false | |
| var body: some View { | |
| VStack { | |
| Spacer() | |
| ZStack { | |
| Image(systemName: "heart.fill") |
This file contains hidden or 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
| // by dave | |
| float[][] result; | |
| float t, c; | |
| float ease(float p) { | |
| p = c01(p); | |
| return 3*p*p - 2*p*p*p; | |
| } | |
| float ease(float p, float g) { |
This file contains hidden or 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
| //------------------------------------------------------------------------ | |
| // Author: The SwiftUI Lab | |
| // Post: Advanced SwiftUI Animations - Part 4 | |
| // Link: https://swiftui-lab.com/swiftui-animations-part4 (TimelineView) | |
| // | |
| import SwiftUI | |
| struct CyclicTimelineSchedule: TimelineSchedule { | |
| let timeOffsets: [TimeInterval] |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
This file contains hidden or 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
| #!/usr/bin/ruby | |
| # Create display override file to force Mac OS X to use RGB mode for Display | |
| # see http://embdev.net/topic/284710 | |
| require 'base64' | |
| data=`ioreg -l -d0 -w 0 -r -c AppleDisplay` | |
| edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten | |
| vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten |
This file contains hidden or 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 Foundation | |
| import SwiftUI | |
| struct GradientCircle: View { | |
| var body: some View { | |
| let color1 = Color.init(red: 81/255, green: 204/255, blue: 159/255) | |
| let color2 = Color.init(red: 154/255, green: 255/255, blue: 248/255) | |
| let spectrum = Gradient(colors: [ color1, color2]) | |
| let conic = | |
| LinearGradient(gradient: spectrum, startPoint: UnitPoint(x: 0, y: 0.5), endPoint: UnitPoint(x: 0.5, y: 1)) |
This file contains hidden or 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
| //-------------------------------------------------- | |
| // The SwiftUI Lab: Advanced SwiftUI Animations | |
| // https://swiftui-lab.com/swiftui-animations-part1 | |
| //-------------------------------------------------- | |
| import SwiftUI | |
| struct ContentView: View { | |
| var body: some View { | |
| NavigationView { |