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 items: [RandomItem] = (0...25).indices.map { _ in RandomItem() } | |
var body: some View { | |
ScrollViewReader { proxy in | |
List { | |
ForEach(items) { item in | |
Text("\(item.number)") |
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 Charts | |
@available(iOS 16.0, *) | |
struct ContentView: View { | |
@State private var opacity = -0.5 | |
var body: some View { | |
VStack { | |
Chart(SalesData.last30Days, id: \.day) { |
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 Charts | |
@available(iOS 16.0, *) | |
struct ContentView: View { | |
@State private var selection: HashableItem? | |
var body: some View { | |
// MARK: - 1. Baseline performance test | |
// Scrolling is smooth, CPU averages around 10% when scrolling |
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 Charts | |
struct ContentView: View { | |
@State private var grid = Grid(numRows: 10, numCols: 10) | |
var body: some View { | |
if #available(iOS 16.0, *) { | |
VStack { | |
Spacer() |
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(alignment: .leading) { | |
HStack { | |
Image(systemName: "xmark") | |
.font(Font.title.weight(.bold)) | |
.foregroundColor(.gray) | |
ZStack(alignment: .leading) { |
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 { | |
// sample of data was compiled using the following sources: | |
// https://birdgei.com/2011/08/30/list-of-100-irregular-plural-nouns-in-english/ | |
// https://www.grammarly.com/blog/plural-nouns/ | |
// https://www.thoughtco.com/irregular-plural-nouns-in-english-1692634 | |
// https://www.ef.co.uk/english-resources/english-grammar/singular-and-plural-nouns/ | |
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 { | |
let animals = ["bear", | |
"buffalo", | |
"cow", | |
"fish", | |
"fox", | |
"goose", | |
"ox", |
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 VerticalAlignment { | |
struct VertAlignName: AlignmentID { | |
static func defaultValue(in d: ViewDimensions) -> CGFloat { | |
d[.top] | |
} | |
} | |
static let vertAlignName = VerticalAlignment(VertAlignName.self) | |
} |
NewerOlder