Remove deprecation warnings for Xcode beta4

This commit is contained in:
John Holdsworth
2019-07-28 12:10:01 +01:00
parent 57e72ec52c
commit 7af0a711da
40 changed files with 63 additions and 61 deletions

View File

@@ -20,7 +20,7 @@ struct CategoryRow: View {
ScrollView(.horizontal) {
HStack(alignment: .top, spacing: 0) {
ForEach(self.items.identified(by: \.name)) { landmark in
ForEach(self.items, id: \.name) { landmark in
NavigationLink(
destination: LandmarkDetail(
landmark: landmark
@@ -45,7 +45,7 @@ struct CategoryItem: View {
.renderingMode(.original)
.cornerRadius(5)
Text(landmark.name)
.color(.primary)
.foregroundColor(.primary)
.font(.caption)
}
.padding(.leading, 15)

View File

@@ -23,13 +23,13 @@ struct HikeDetail: View {
.frame(height: 200, alignment: .center)
HStack(spacing: 25) {
ForEach(buttons.identified(by: \.0)) { value in
ForEach(buttons, id: \.0) { value in
Button(action: {
self.dataToShow = value.1
}) {
Text(verbatim: value.0)
.font(.system(size: 15))
.color(value.1 == self.dataToShow
.foregroundColor(value.1 == self.dataToShow
? Color.gray
: Color.accentColor)
.animation(nil)

View File

@@ -28,7 +28,7 @@ struct CategoryHome: View {
.clipped()
.listRowInsets(EdgeInsets())
ForEach(categories.keys.sorted().identified(by: \.self)) { key in
ForEach(categories.keys.sorted(), id: \.self) { key in
CategoryRow(categoryName: key, items: self.categories[key]!)
}
.listRowInsets(EdgeInsets())

View File

@@ -35,7 +35,7 @@ struct LandmarkList: View {
#if DEBUG
struct LandmarksList_Previews: PreviewProvider {
static var previews: some View {
ForEach(["iPhone SE", "iPhone XS Max"].identified(by: \.self)) { deviceName in
ForEach(["iPhone SE", "iPhone XS Max"], id: \.self) { deviceName in
LandmarkList()
.previewDevice(PreviewDevice(rawValue: deviceName))
.previewDisplayName(deviceName)