mirror of
https://github.com/ivanvorobei/SwiftUI.git
synced 2026-04-30 20:44:26 +02:00
Update
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
See LICENSE folder for this sample’s licensing information.
|
||||
|
||||
Abstract:
|
||||
A view that clips an image to a circle and adds a stroke and shadow.
|
||||
*/
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct CircleImage: View {
|
||||
var body: some View {
|
||||
Image("turtlerock")
|
||||
.clipShape(Circle())
|
||||
.overlay(
|
||||
Circle().stroke(Color.white, lineWidth: 4))
|
||||
.shadow(radius: 10)
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
struct CircleImage_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
CircleImage()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
See LICENSE folder for this sample’s licensing information.
|
||||
|
||||
Abstract:
|
||||
A view that hosts an `MKMapView`.
|
||||
*/
|
||||
|
||||
import SwiftUI
|
||||
import MapKit
|
||||
|
||||
struct MapView: UIViewRepresentable {
|
||||
func makeUIView(context: Context) -> MKMapView {
|
||||
MKMapView(frame: .zero)
|
||||
}
|
||||
|
||||
func updateUIView(_ view: MKMapView, context: Context) {
|
||||
let coordinate = CLLocationCoordinate2D(
|
||||
latitude: 34.011_286, longitude: -116.166_868)
|
||||
let span = MKCoordinateSpan(latitudeDelta: 2.0, longitudeDelta: 2.0)
|
||||
let region = MKCoordinateRegion(center: coordinate, span: span)
|
||||
view.setRegion(region, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
struct MapView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
MapView()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user