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 { | |
var text = "long text" | |
@State private var lines = 3.0 | |
var body: some View { | |
ScrollView { | |
ReadMore(lineLimit: Int(lines)) { |
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 MediaPlayer | |
import SwiftUI | |
struct ContentView: View { | |
@State var sliderValue: Float = 0 | |
@StateObject var observer = VolumeObserver() | |
var body: some View { | |
VStack { |
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
enum Effect { | |
/// Action completed synchronously | |
case none | |
/// Action produced a task | |
case task(Task<Void, Never>) | |
/// Notify about completion in a closure | |
func onCompletion(_ completion: @escaping () -> Void) { | |
switch self { |
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 | |
private struct AlertPresentationWindow: View { | |
@ObservedObject var service: ErrorStateService | |
var body: some View { | |
Color.clear | |
.alert( | |
service.alerts.first?.title ?? "Error", | |
isPresented: .init( |
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 BlobbySymbol<Primary: View, Alternative: View>: Animatable, View { | |
private var progress: Double = 0 | |
var animatableData: Double { | |
get { progress } | |
set { progress = newValue } | |
} |
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
// RE: | |
// https://gist.github.com/ole/4a8b5fe49d53c79b34e22b3401872093 | |
// https://mobile.twitter.com/olebegemann/status/1572163020695928832 | |
import SwiftUI | |
struct Item: Identifiable { | |
var id: UUID = .init() | |
var country: String | |
var population: String |
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 Combine | |
import SwiftUI | |
import SwiftUIBackports | |
@main | |
struct BackportTestApp: App { | |
var body: some Scene { | |
WindowGroup { | |
ContentView() | |
} |
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 { | |
typealias Item = (Color, CGFloat) | |
@State private var columnCount = 3 | |
@State private var isWaterfall = true | |
@State var items: [Item] = [ |
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 { | |
var body: some View { | |
CoreTextShape( | |
string: "Hello YUMEMI.swift!", | |
font: .boldSystemFont(ofSize: 42) | |
) | |
.border(.purple) | |
.padding() |
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
// The main layout logic | |
import SwiftUI | |
final class LayoutAdaptor: UIView { | |
var layout: (any Layout)? { | |
didSet { setNeedsLayout() } | |
} | |
override func layoutSubviews() { |
NewerOlder