Whats new in SwiftUI 3.0

Photo by Adi Goldstein on Unsplash
struct SomeView: View {
var body: some View {
VStack {
List(1...10) { item in
Text("Item number \(item)")
}
.refreshable {
//enter code to execute during refresh here
}
}
}
}
struct SomeView: View {
var body: some View {
List {
ForEach(1...10, id: \.self) { item in
Text("Item Number \(item)")
.swipeActions(edge: .leading) {
Button {
//enter button actions here
} label: {
Text("Action Here")
}
}
}
}
}
struct Cars: Identifiable {
var id = UUID()
var name: String
}
struct SomeView: View {
@State var searchText: String = ""
@State var cars: [Cars] = [Cars(name: "Nissan"), Cars(name: "Mercedes"), Cars(name: "BMW")]
var body: some View {
NavigationView {
List($cars) { $car in
Text(car.name)
}
.searchable("Search cars", text: $searchText, placement: .automatic) {
Text("mer".searchCompletion("Mercedes")
}
}
}

var searchResults: [Cars] {
is searchText.isEmpty {
return cars
} else {
return cars.filter{$0.name.lowercase().contains(searchText.lowercased())}
}
}
}

--

--

var title = “iOS Engineer @ Lunchbox”

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store