MapKit, but for SwiftUI

Last update: Apr 5, 2022

MapKit-SwiftUI

MapKit, but with SwiftUI!

Examples

Example 1: Simple Map

import MapKitSwiftUI

struct ContentView: View {

    var body: some View {
        AppleMap(lat: 42.336777, long: -71.097242)
            .displayCompass()
            .pointsOfInterest(include: [.school, .cafe, .park])
            .zoomBoundry(500..<2500)
            .ignoresSafeArea()
    }
    
}

Configuring your AppleMap is easy.

Example 2: Markers

let places: [Place] = [
    Place("Coffee! 鈽曪笍", lat: 42.33562, long: -71.095651),
    Place("Campus 馃", lat: 42.336777, long: -71.097242)
]

var body: some View {
    AppleMap(lat: 42.336777, long: -71.097242, annotations: places) {
        Marker(lat: $0.coordinate.latitude, long: $0.coordinate.longitude)
            .title($0.name, subtitle: "Place of interest")
            .color(.systemPurple)
            .glyphImage(systemName: "building.fill")
    }
        .zoomBoundry(500..<2500)
        .boundary(distance: 250)
}

Easily add markers or pins to the map by using the Marker and Pin models

struct Place {

    let name: String
    let lat: Double
    let long: Double
    
    init(_ name, lat: Double, long: Double) {
        self.name = name
        self.lat = lat
        self.long = long
    }
    
}

Place model I used in example 2 and 3

Example 3: Pins

import MapKitSwiftUI

struct ContentView: View {

    let places: [Place] = [
        Place("Coffee! 鈽曪笍", lat: 42.33562, long: -71.095651),
        Place("Campus 馃", lat: 42.336777, long: -71.097242)
    ]

    var body: some View {
        AppleMap(lat: 42.336777, long: -71.097242, annotations: places) {
            Pin(lat: $0.coordinate.latitude, long: $0.coordinate.longitude)
                .title($0.name)
                .color(.systemBlue)
        }
            .zoomBoundry(500..<2500)
            .boundary(distance: 250)
    }
    
}

Pins are very similar to Markers

GitHub

https://github.com/lawrencebensaid/MapKit-SwiftUI
You might also like...

You can touch My Swift, MapKit, UX skills! :D

You can touch My Swift, MapKit, UX skills! :D

What is it? 馃檵馃徎 It's a pet project which has been developed as a code challenge. It's written purely in Swift without using 3rd party frameworks. Wha

Jun 15, 2022

Like a SwiftUI ViewBuilder, but for Text

Like a SwiftUI ViewBuilder, but for Text

TextBuilder Introduction Text composition in SwiftUI can often be cumbersome, especially when there's logic affecting its format and content. TextBuil

May 17, 2022

Your SwiftUI custom slider is crap. Here's mine, which is also crap, but it's my crap

Fuck your custom slider It doesn't work. Sure, it looks great, with gradients, and multiple thumbs, but really, it's useless. No more paying for a sub

Nov 29, 2021

EasyMenu - SwiftUI Menu but not only button (similar to the native Menu)

EasyMenu - SwiftUI Menu but not only button (similar to the native Menu)

EasyMenu SwiftUI Menu but not only button (similar to the native Menu) You can c

Apr 24, 2022

Cache - Nothing but Cache.

Cache - Nothing but Cache.

Cache doesn't claim to be unique in this area, but it's not another monster library that gives you a god's power. It does nothing but caching, but it does it well. It offers a good public API with out-of-box implementations and great customization possibilities. Cache utilizes Codable in Swift 4 to perform serialization.

Jun 18, 2022

Carlos - A simple but flexible cache, written in Swift for iOS 13+ and WatchOS 6 apps.

Carlos A simple but flexible cache, written in Swift for iOS 13+ and WatchOS 6 apps. Breaking Changes Carlos 1.0.0 has been migrated from PiedPiper de

Jun 15, 2022

Tranquillity is a lightweight but powerful dependency injection library for swift.

Tranquillity is a lightweight but powerful dependency injection library for swift.

DITranquillity Tranquillity is a lightweight but powerful dependency injection library for swift. The name "Tranquillity" laid the foundation in the b

Jun 18, 2022

MisterFusion is Swift DSL for AutoLayout. It is the extremely clear, but concise syntax, in addition, can be used in both Swift and Objective-C. Support Safe Area and Size Class.

MisterFusion is Swift DSL for AutoLayout. It is the extremely clear, but concise syntax, in addition, can be used in both Swift and Objective-C. Support Safe Area and Size Class.

MisterFusion MisterFusion makes more easier to use AutoLayout in Swift & Objective-C code. Features Simple And Concise Syntax Use in Swift and Objecti

Jun 14, 2022

A compact but full-featured Auto Layout DSL for Swift

A compact but full-featured Auto Layout DSL for Swift

Mortar allows you to create Auto Layout constraints using concise, simple code statements. Use this: view1.m_right |=| view2.m_left - 12.0 Instead of:

Jan 29, 2022

馃敟 PMSuperButton is a powerful UIButton coming from the countryside, but with super powers! 馃槑

馃敟 PMSuperButton is a powerful UIButton coming from the countryside, but with super powers! 馃槑

PMSuperButton is a powerful UIButton coming from the countryside, but with super powers! 馃槑 An easy way to create custom and complex buttons with cust

May 30, 2022

BrainCore is a simple but fast neural network framework written in Swift.

BrainCore is a simple but fast neural network framework written in Swift. It uses Metal which makes it screamin' fast. If you want to see it

May 17, 2022

Codable, but with Super power made custom Codable behavior easy.

Codable, but with Super power made custom Codable behavior easy.

May 7, 2022

A view that shows selectable symbols, similar to UITableView's `sectionIndexTitles` API but with support for symbols and more flexibility

A view that shows selectable symbols, similar to UITableView's `sectionIndexTitles` API but with support for symbols and more flexibility

馃摉 TableOfContentsSelector Are you familiar with UITableView's sectionIndexTitles API? The little alphabet on the side of some tables for quickly jump

Jun 14, 2022

Example on how to print a NSTableView from your app but then also add text to the print-out.

Example on how to print a NSTableView from your app but then also add text to the print-out.

NSTableView Printing Test This is a demo project so you can check out how printing a table could work. The goal here is to show tabular data on screen

Mar 29, 2022

Swift Property Wrappers, but in Objective-C. And done horribly.

TOPropertyAccessor is an open source, Objective-C abstract class. Similar to Realm's Cocoa API, it uses the dynamic nature of the Objective-C runtime to access the properties of any of its subclasses, and routes calling them through overridable access points.

May 23, 2021

A charting library to visualize and interact with a vector map on iOS. It's like Geochart but for iOS!

A charting library to visualize and interact with a vector map on iOS. It's like Geochart but for iOS!

FSInteractiveMap A charting library to visualize data on a map. It's like geochart but for iOS! The idea behind this library is to load a SVG file of

May 19, 2022

A calculator for your Apple Watch but only if you have fingers small enough to press the buttons.

A calculator for your Apple Watch but only if you have fingers small enough to press the buttons.

AppleWatchCalculator A calculator for your Apple Watch but only if you have fingers small enough to press the buttons. A very simple calculator on you

Feb 8, 2022
Example app using MessagesUI + CoreLocation + MapKit

iOS Example MapKit App Ejemplo de c贸digo de una aplicaci贸n de mapas usando MessagesUI, MapKit y CoreLocation Built using XCode 13.0 (Swift 5) 驴C贸mo ej

Oct 19, 2021
JDSwiftMap is an IOS Native MapKit Library. You can easily make a highly customized HeatMap.
JDSwiftMap is an IOS Native MapKit Library.  You can easily make a highly customized HeatMap.

JDSwiftMap is an IOS Native MapKit Library. You can easily make a highly customized HeatMap. Installation Cocoapods pod 'JDSWiftHeatMap' Usage JDSwi

Jun 18, 2022
An iOS map clustering framework targeting MapKit, Google Maps and Mapbox.
An iOS map clustering framework targeting MapKit, Google Maps and Mapbox.

ClusterKit is an elegant and efficiant clustering controller for maps. Its flexible architecture make it very customizable, you can use your own algor

May 27, 2022
MKMapView wrapper for SwiftUI as drop-in to MapKit's SwiftUI view
MKMapView wrapper for SwiftUI as drop-in to MapKit's SwiftUI view

MKMapView wrapper for SwiftUI as drop-in to MapKit's SwiftUI view. Easily extensible annotations and overlays, iOS 13 support and backwards compatible with MKAnnotation and MKOverlay!

Jun 22, 2022
SwiftUI app with MapKit
SwiftUI app with MapKit

InterestingPlaces app that contains information about unusual places in the world.

May 23, 2022
SwiftUI wrapper for MapKit's MKMapView (UIKit).
SwiftUI wrapper for MapKit's MKMapView (UIKit).

SwiftUIMKMapView SwiftUI wrapper for MapKit's MKMapView (UIKit). 鈻讹笍 Usage Add as a dependecy to your project using Swift Package Manager. Embed map vi

Apr 4, 2022
Example app using MessagesUI + CoreLocation + MapKit

iOS Example MapKit App Ejemplo de c贸digo de una aplicaci贸n de mapas usando MessagesUI, MapKit y CoreLocation Built using XCode 13.0 (Swift 5) 驴C贸mo ej

Oct 19, 2021
JDSwiftMap is an IOS Native MapKit Library. You can easily make a highly customized HeatMap.
JDSwiftMap is an IOS Native MapKit Library.  You can easily make a highly customized HeatMap.

JDSwiftMap is an IOS Native MapKit Library. You can easily make a highly customized HeatMap. Installation Cocoapods pod 'JDSWiftHeatMap' Usage JDSwi

Jun 18, 2022
An iOS map clustering framework targeting MapKit, Google Maps and Mapbox.
An iOS map clustering framework targeting MapKit, Google Maps and Mapbox.

ClusterKit is an elegant and efficiant clustering controller for maps. Its flexible architecture make it very customizable, you can use your own algor

May 27, 2022
Using CoreLocation and MapKit Together
Using CoreLocation and MapKit Together

Using_CoreLocation_and_MapKit_Together CoreLocation and Mapkit were used togethe

Feb 18, 2022