Skip to content

Instantly share code, notes, and snippets.

@itjustcrashed
Last active September 8, 2024 03:17
Show Gist options
  • Save itjustcrashed/f49d3a95666b23e3c79fab39c62ec75e to your computer and use it in GitHub Desktop.
Save itjustcrashed/f49d3a95666b23e3c79fab39c62ec75e to your computer and use it in GitHub Desktop.
MapKit icon fetcher
func markerIcon(for mapItem: MKMapItem) -> String {
let catagory = mapItem.pointOfInterestCategory
var icon = "mappin"
if catagory == .museum {
icon = "building.columns"
} else if catagory == .musicVenue {
icon = "music.microphone"
} else if catagory == .theater {
icon = "theatermasks"
} else if catagory == .library {
icon = "books.vertical"
} else if catagory == .planetarium {
icon = "moon.stars"
} else if catagory == .school {
icon = "globe.desk"
} else if catagory == .university {
icon = "graduationcap"
} else if catagory == .movieTheater {
icon = "popcorn"
} else if catagory == .nightlife {
icon = "moon"
} else if catagory == .fireStation {
icon = "fire.extinguisher"
} else if catagory == .hospital {
icon = "cross"
} else if catagory == .pharmacy {
icon = "cross.vial"
} else if catagory == .police {
icon = "shield.lefthalf.filled"
} else if catagory == .castle {
icon = "building.columns"
} else if catagory == .fortress {
icon = "building.columns"
} else if catagory == .landmark {
icon = "star"
} else if catagory == .nationalMonument {
icon = "building.columns"
} else if catagory == .bakery {
icon = "birthday.cake"
} else if catagory == .brewery {
icon = "mug"
} else if catagory == .cafe {
icon = "cup.and.saucer"
} else if catagory == .distillery {
icon = "wineglass"
} else if catagory == .foodMarket {
icon = "carrot"
} else if catagory == .restaurant {
icon = "fork.knife"
} else if catagory == .winery {
icon = "wineglass"
} else if catagory == .animalService {
icon = "pawprint"
} else if catagory == .atm {
icon = "banknote"
} else if catagory == .automotiveRepair {
icon = "car.badge.gearshape"
} else if catagory == .bank {
icon = "dollarsign.bank.building"
} else if catagory == .beauty {
icon = "sparkles"
} else if catagory == .evCharger {
icon = "ev.charger"
} else if catagory == .fitnessCenter {
icon = "dumbbell"
} else if catagory == .laundry {
icon = "washer"
} else if catagory == .mailbox {
icon = "mail.stack"
} else if catagory == .postOffice {
icon = "envelope"
} else if catagory == .restroom {
icon = "figure.stand.dress.line.vertical.figure"
} else if catagory == .spa {
icon = "bathtub"
} else if catagory == .store {
icon = "bag"
} else if catagory == .amusementPark {
icon = "balloon.2"
} else if catagory == .aquarium {
icon = "fish"
} else if catagory == .beach {
icon = "beach.umbrella"
} else if catagory == .campground {
icon = "house.lodge"
} else if catagory == .fairground {
icon = "party.popper"
} else if catagory == .marina {
icon = "ferry"
} else if catagory == .nationalPark {
icon = "mountain.2"
} else if catagory == .park {
icon = "tree"
} else if catagory == .rvPark {
icon = "truck.box"
} else if catagory == .zoo {
icon = "tortoise"
} else if catagory == .baseball {
icon = "figure.baseball"
} else if catagory == .basketball {
icon = "figure.basketball"
} else if catagory == .bowling {
icon = "figure.bowling"
} else if catagory == .goKart {
icon = "car.rear.and.tire.marks"
} else if catagory == .golf {
icon = "figure.golf"
} else if catagory == .hiking {
icon = "figure.hiking"
} else if catagory == .miniGolf {
icon = "figure.golf"
} else if catagory == .rockClimbing {
icon = "figure.climbing"
} else if catagory == .skatePark {
icon = "figure.skateboarding"
} else if catagory == .skating {
icon = "figure.ice.skating"
} else if catagory == .skiing {
icon = "figure.skiing.downhill"
} else if catagory == .soccer {
icon = "figure.indoor.soccer"
} else if catagory == .stadium {
icon = "mappin"
} else if catagory == .tennis {
icon = "figure.tennis"
} else if catagory == .volleyball {
icon = "figure.volleyball"
} else if catagory == .airport {
icon = "airplane.departure"
} else if catagory == .carRental {
icon = "car.2"
} else if catagory == .conventionCenter {
icon = "person.3.sequence.fill"
} else if catagory == .gasStation {
icon = "fuelpump"
} else if catagory == .hotel {
icon = "building.2"
} else if catagory == .parking {
icon = "parkingsign.square"
} else if catagory == .publicTransport {
icon = "train.side.front.car"
} else if catagory == .fishing {
icon = "figure.fishing"
} else if catagory == .kayaking {
icon = "water.waves"
} else if catagory == .surfing {
icon = "figure.surfing"
} else if catagory == .swimming {
icon = "figure.open.water.swim"
}
return icon
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment