{"id":18131524,"url":"https://github.com/sgade/swiftui-mapview","last_synced_at":"2025-08-02T16:41:10.297Z","repository":{"id":52238376,"uuid":"241979875","full_name":"sgade/swiftui-mapview","owner":"sgade","description":"MKMapView in SwiftUI","archived":false,"fork":false,"pushed_at":"2022-09-20T10:47:54.000Z","size":2241,"stargazers_count":145,"open_issues_count":0,"forks_count":27,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-06-27T13:17:26.587Z","etag":null,"topics":["mkmapview","swift","swiftui"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sgade.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-20T20:12:26.000Z","updated_at":"2025-02-27T02:02:02.000Z","dependencies_parsed_at":"2022-08-26T05:50:25.750Z","dependency_job_id":null,"html_url":"https://github.com/sgade/swiftui-mapview","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/sgade/swiftui-mapview","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgade%2Fswiftui-mapview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgade%2Fswiftui-mapview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgade%2Fswiftui-mapview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgade%2Fswiftui-mapview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sgade","download_url":"https://codeload.github.com/sgade/swiftui-mapview/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgade%2Fswiftui-mapview/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262996287,"owners_count":23396902,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mkmapview","swift","swiftui"],"created_at":"2024-11-01T12:07:50.490Z","updated_at":"2025-07-01T16:05:51.920Z","avatar_url":"https://github.com/sgade.png","language":"Swift","readme":"# swiftui-mapview\n\n![Swift Version](https://img.shields.io/badge/Swift-5.1-orange.svg?logo=swift)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fsgade%2Fswiftui-mapview%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/sgade/swiftui-mapview)\n![Platforms](https://img.shields.io/badge/Platforms-iOS-yellow.svg?logo=apple)\n\n[MKMapView](https://developer.apple.com/documentation/mapkit/mkmapview) in SwiftUI.\n\n**For iOS 14 and later, please use Apple's official [Map](https://developer.apple.com/documentation/mapkit/map) view.**\n\n[![Social Preview](assets/social-preview.png)](assets/screen.png)\n(Click the image to see the full screenshot)\n\n## Install\n\nUsing Xcode, select `File` -\u003e `Swift Packages` -\u003e `Add Package Dependency` and enter `https://github.com/sgade/swiftui-mapview`.\n\n## Usage\n\nIn your view, add the map.\nSee the [example project](MapViewExample) for how to integrate the map view.\n\n```swift\nimport SwiftUIMapView\n\nstruct ContentView: View {\n    var body: some View {\n        MapView()\n    }\n}\n```\n\n### General\n\n#### Map type\n\n```swift\nMapView(mapType: .standard)\n```\n\n### User location\n\n#### Showing the current user location\n\nThe current location can be shown on the map. By default, this is `true`.\nNote that the application requires permission to access the current user location.\nSee the documentation on `MapView.showsUserLocation` for more information.\n\n```swift\nMapView(showsUserLocation: true)\n```\n\n#### Tracking the user's location\n\n```swift\nMapView(userTrackingMode: .follow)\n```\n\n### Region\n\n#### Setting the visible region center\n\nThe binding passed in for `center` defines the visible region. Setting it to `nil` will use the map's default region when loaded.\nIt is also updated when the visible region changes.\n\n```swift\n@State var center: CLLocationCoordinate2D?\n\nMapView(center: self.$center)\n```\n\n#### Setting the visible region zoom\n\nThe binding passed in for `zoom` defines the visible region span. A default zoom is used if you do not specify any value.\nIt is also updated when the visible region changes.\n\n```swift\n@State var zoom: MKCoordinateSpan\n\nMapView(zoom: self.$zoom)\n```\n\n### Annotations\n\n### Adding annotations\n\nAnnotations are represented as objects of a custom class that implements the `MapViewAnnotation` protocol.\nIt might be helpful to sublcass from existing classes like `MKPlacemark`.\n\n```swift\nlet annotations: [MapViewAnnotation] = ...\n\nMapView(annotation: self.annotations)\n```\n\n### Selecting annotations\n\nA list of selected annotations can be passed in via binding.\nSelecting an annotations updates the binding, and the other way around.\n\n```swift\n@State var selectedAnnotations: [MapViewAnnotation] = []\n\nMapView(selectedAnnotations: self.$selectedAnnotations)\n```\n\n## Contributing\n\nSee the [contributing guide](CONTRIBUTING.md).\n\n## License\n\nThis project is licensed unter the terms of the MIT license. See [LICENSE](./LICENSE) for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgade%2Fswiftui-mapview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsgade%2Fswiftui-mapview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgade%2Fswiftui-mapview/lists"}