mirror of
https://github.com/ivanvorobei/SwiftUI.git
synced 2026-03-20 00:24:17 +01:00
Minimum changes for Xcode 11 beta 5
This commit is contained in:
@@ -8,6 +8,8 @@ A view showing featured landmarks above a list of all of the landmarks.
|
||||
import SwiftUI
|
||||
|
||||
struct CategoryHome: View {
|
||||
@State private var isProfilePresented = false
|
||||
|
||||
var categories: [String: [Landmark]] {
|
||||
.init(
|
||||
grouping: landmarkData,
|
||||
@@ -39,13 +41,16 @@ struct CategoryHome: View {
|
||||
}
|
||||
.navigationBarTitle(Text("Featured"))
|
||||
.navigationBarItems(trailing:
|
||||
PresentationLink(destination: Text("User Profile")) {
|
||||
Button(action: {
|
||||
self.isProfilePresented = true
|
||||
}) {
|
||||
Image(systemName: "person.crop.circle")
|
||||
.imageScale(.large)
|
||||
.accessibility(label: Text("User Profile"))
|
||||
.padding()
|
||||
}
|
||||
)
|
||||
).sheet(isPresented: $isProfilePresented,
|
||||
content: { Text("User Profile") })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ final class ImageStore {
|
||||
?? _sizeImage(images.values[index][ImageStore.originalSize]!, to: size * ImageStore.scale)
|
||||
images.values[index][size] = sizedImage
|
||||
|
||||
return Image(sizedImage, scale: Length(ImageStore.scale), label: Text(verbatim: name))
|
||||
return Image(sizedImage, scale: CGFloat(ImageStore.scale), label: Text(verbatim: name))
|
||||
}
|
||||
|
||||
fileprivate func _guaranteeInitialImage(name: String) -> _ImageDictionary.Index {
|
||||
|
||||
@@ -9,20 +9,20 @@ import SwiftUI
|
||||
|
||||
struct GraphCapsule: View {
|
||||
var index: Int
|
||||
var height: Length
|
||||
var height: CGFloat
|
||||
var range: Range<Double>
|
||||
var overallRange: Range<Double>
|
||||
|
||||
var heightRatio: Length {
|
||||
max(Length(magnitude(of: range) / magnitude(of: overallRange)), 0.15)
|
||||
var heightRatio: CGFloat {
|
||||
max(CGFloat(magnitude(of: range) / magnitude(of: overallRange)), 0.15)
|
||||
}
|
||||
|
||||
var offsetRatio: Length {
|
||||
Length((range.lowerBound - overallRange.lowerBound) / magnitude(of: overallRange))
|
||||
var offsetRatio: CGFloat {
|
||||
CGFloat((range.lowerBound - overallRange.lowerBound) / magnitude(of: overallRange))
|
||||
}
|
||||
|
||||
var animation: Animation {
|
||||
Animation.spring(initialVelocity: 5)
|
||||
Animation.spring()
|
||||
.speed(2)
|
||||
.delay(0.03 * Double(index))
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ struct HikeGraph: View {
|
||||
let data = hike.observations
|
||||
let overallRange = rangeOfRanges(data.lazy.map { $0[keyPath: self.path] })
|
||||
let maxMagnitude = data.map { magnitude(of: $0[keyPath: path]) }.max()!
|
||||
let heightRatio = 1 - Length(maxMagnitude / magnitude(of: overallRange))
|
||||
let heightRatio = 1 - CGFloat(maxMagnitude / magnitude(of: overallRange))
|
||||
|
||||
return GeometryReader { proxy in
|
||||
HStack(alignment: .bottom, spacing: proxy.size.width / 120) {
|
||||
|
||||
Reference in New Issue
Block a user