3 Replies to “Implementing factory design pattern in Swift”

  1. class Map {
    let type : Int = 0
    func showMap…
    should be:
    class Map {
    let type: Int = 0
    func makeMap…
    and then:
    let map = Map()
    map.makeMap(type: Maps.google).showMap()
    map.makeMap(type: Maps.apple).showMap()
    will show:
    showing google map
    showing apple map

Leave a Reply

Your email address will not be published.