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 { | |
VStack { | |
TextSampleView(style: .foreground) | |
TextSampleView(style: .mint) | |
TextSampleView(style: linearGradient) | |
} | |
.font(.largeTitle) |
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 | |
final class ViewController: UIViewController, UICollectionViewDataSource { | |
private lazy var collectionView: UICollectionView = { | |
var configuration = UICollectionLayoutListConfiguration(appearance: .insetGrouped) | |
configuration.separatorConfiguration.bottomSeparatorInsets = .init(top: 0, leading: 100, bottom: 0, trailing: 0) | |
let layout = UICollectionViewCompositionalLayout.list(using: configuration) | |
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout) | |
collectionView.backgroundColor = .systemGroupedBackground |
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 | |
final class ViewController: UIViewController { | |
private var products = Product.products() | |
private lazy var tableView: UITableView = { | |
let tableView = UITableView() | |
tableView.translatesAutoresizingMaskIntoConstraints = false | |
tableView.dataSource = 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 | |
import Observation | |
struct ContentView: View { | |
@State private var model = MazeObject(width: 39, height: 39) | |
@State private var resetID = UUID() | |
@State private var disabled = false | |
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
import SwiftUI | |
private let appleColors: [Color] = [ | |
.black, | |
.blue, | |
.green, | |
.purple, | |
.mint, | |
.teal, | |
.indigo, |
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 var id = UUID() | |
@State var offset = CGSize.zero | |
@State var control = SIMD2<Float>(0, 0) | |
var body: some View { | |
GeometryReader { geometry in | |
let size = geometry.size |
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 { | |
ScrollView(.vertical) { | |
ForEach(0..<1000) { i in | |
RoundedRectangle(cornerRadius: 24) | |
.fill(.blue) | |
.frame(height: 100) | |
.padding(.horizontal) |
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 { | |
ScrollView(.vertical) { | |
ForEach(0..<1000) { i in | |
RoundedRectangle(cornerRadius: 24) | |
.fill(.purple) | |
.frame(height: 100) | |
.padding(.horizontal) |
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 var rating: Double = 0 | |
var body: some View { | |
HStack(spacing: 18) { | |
Button( | |
action: { withAnimation { rating -= 1 } }, | |
label: { Image(systemName: "minus.circle") } |
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 FlowLayoutSampleView: View { | |
@State var width: CGFloat = 180 | |
let tags: [String] = [ | |
"Objective-C", | |
"Swift", | |
// "SwiftSwiftSwiftSwiftSwiftSwiftSwiftSwift", | |
// "SwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwiftSwift", |
NewerOlder