View marquee.swift
This file contains 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 | |
struct Helper<Result: View>: _VariadicView_MultiViewRoot { | |
var _body: (_VariadicView.Children) -> Result | |
func body(children: _VariadicView.Children) -> some View { | |
_body(children) | |
} |
View TextView.swift
This file contains 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 | |
struct MyTextEditor: NSViewRepresentable { | |
@Binding var text: String | |
final class Coordinator: NSObject, NSTextViewDelegate { | |
var text: Binding<String> |
View one.swift
This file contains 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 | |
struct ContentView: View { | |
@State private var toggle = true | |
@Namespace private var ns | |
var body: some View { | |
let box = Rectangle() | |
.fill(.tertiary) |
View SimpleRepresentable.swift
This file contains 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 UIKit | |
import SwiftUI | |
struct ContentView2: View { | |
var body: some View { | |
VStack { | |
SimpleRepresentable(text: "Test") | |
} | |
} | |
} |
View progress.swift
This file contains 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 | |
struct MyProgress: View, Animatable { | |
var progress: Double | |
var animatableData: Double { | |
get { progress } | |
set { progress = newValue } |
View ContentView.swift
This file contains 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 | |
struct ContentView: View { | |
@State private var color0 = Color.red | |
@State private var color1 = Color.red | |
var body: some View { | |
VStack { | |
color0 | |
color1 | |
} |
View easeinbounce.swift
This file contains 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 | |
import Observation | |
// easeInBounce | |
// | |
// https://easings.net | |
// https://gist.github.com/girish3/11167208 |
View .swiftlint.yml
This file contains 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
disabled_rules: | |
- trailing_comma | |
opt_in_rules: | |
- file_header | |
file_header: | |
forbidden_pattern: /./ | |
custom_rules: | |
state_private: | |
name: "Private SwiftUI State" | |
regex: "\\@State\\s*var" |
View ViewToPDF.swift
This file contains 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 | |
extension View { | |
@MainActor | |
func pdf(size: ProposedViewSize) -> Data { | |
let renderer = ImageRenderer(content: self) | |
renderer.proposedSize = size | |
var pdfData = NSMutableData() | |
renderer.render { size, render in | |
var mediaBox = CGRect(origin: .zero, size: size) |
View overlay.swift
This file contains 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
// | |
// ContentView.swift | |
// OverlayTest | |
// | |
// Created by Chris Eidhof on 26.09.22. | |
// | |
import SwiftUI | |
struct ContentView: View { |
NewerOlder