Dimitris Togias

add custom annotation class and add direction handler

......@@ -35,6 +35,7 @@
A079367E2885F60A00064122 /* AnalysisHeaderMessageViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A079367D2885F60A00064122 /* AnalysisHeaderMessageViewCell.swift */; };
A080CFD628D170A20045A315 /* MapsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A080CFD428D170A20045A315 /* MapsViewController.swift */; };
A080CFD728D170A20045A315 /* MapsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A080CFD528D170A20045A315 /* MapsViewController.xib */; };
A080CFDA28D1889A0045A315 /* MerchantAnnotation.swift in Sources */ = {isa = PBXBuildFile; fileRef = A080CFD928D1889A0045A315 /* MerchantAnnotation.swift */; };
A09DBCAE2888BA8100DD50B0 /* SharingHistoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A09DBCAD2888BA8100DD50B0 /* SharingHistoryViewController.swift */; };
E6A77853282933340045BBA8 /* SwiftWarplyFramework.docc in Sources */ = {isa = PBXBuildFile; fileRef = E6A77852282933340045BBA8 /* SwiftWarplyFramework.docc */; };
E6A77854282933340045BBA8 /* SwiftWarplyFramework.h in Headers */ = {isa = PBXBuildFile; fileRef = E6A77851282933340045BBA8 /* SwiftWarplyFramework.h */; settings = {ATTRIBUTES = (Public, ); }; };
......@@ -191,6 +192,7 @@
A079367D2885F60A00064122 /* AnalysisHeaderMessageViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalysisHeaderMessageViewCell.swift; sourceTree = "<group>"; };
A080CFD428D170A20045A315 /* MapsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapsViewController.swift; sourceTree = "<group>"; };
A080CFD528D170A20045A315 /* MapsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MapsViewController.xib; sourceTree = "<group>"; };
A080CFD928D1889A0045A315 /* MerchantAnnotation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MerchantAnnotation.swift; sourceTree = "<group>"; };
A09DBCAD2888BA8100DD50B0 /* SharingHistoryViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SharingHistoryViewController.swift; sourceTree = "<group>"; };
A9B7BE01A4E812DE49866EF8 /* Pods-SwiftWarplyFramework.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftWarplyFramework.debug.xcconfig"; path = "Target Support Files/Pods-SwiftWarplyFramework/Pods-SwiftWarplyFramework.debug.xcconfig"; sourceTree = "<group>"; };
B9EB8A451EF0C5AD75094EEE /* Pods-SwiftWarplyFramework.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SwiftWarplyFramework.release.xcconfig"; path = "Target Support Files/Pods-SwiftWarplyFramework/Pods-SwiftWarplyFramework.release.xcconfig"; sourceTree = "<group>"; };
......@@ -382,6 +384,7 @@
isa = PBXGroup;
children = (
A07936722885E67400064122 /* AnalysisItem.swift */,
A080CFD928D1889A0045A315 /* MerchantAnnotation.swift */,
);
name = models;
sourceTree = "<group>";
......@@ -885,6 +888,7 @@
1E74838D28378AF40042A589 /* CouponBarcodeViewController.swift in Sources */,
E6A778F0282933E60045BBA8 /* WLNativeAdsCollectionMode.m in Sources */,
E6A7791C282933E60045BBA8 /* WLSMSActionHandlerDeprecated.m in Sources */,
A080CFDA28D1889A0045A315 /* MerchantAnnotation.swift in Sources */,
E6A77934282933E70045BBA8 /* UIActivityIndicatorView+AFNetworking.m in Sources */,
E6A77A34282BB3BB0045BBA8 /* ActiveGiftsViewController.swift in Sources */,
E6A778E6282933E60045BBA8 /* MyEmptyClass.swift in Sources */,
......
......@@ -2,7 +2,7 @@
// MapsViewController.swift
// SwiftWarplyFramework
//
// Created by Βασιλης Σκουρας on 14/9/22.
// Created by Βασιλης Σκουρας on 10/9/22.
//
import UIKit
......@@ -110,15 +110,18 @@ class MapsViewController: UIViewController, MKMapViewDelegate {
hidePinDetailsView()
}
@IBAction func directionsButtomAction(_ sender: Any) {
}
private func loadMapPins() {
for item in merchantsArray {
let pin = MKPointAnnotation()
pin.coordinate = CLLocationCoordinate2D(latitude: item._latitude, longitude: item._longitude)
let pin = MerchantAnnotation(item)
mapView.addAnnotation(pin)
}
}
private func loadPinDetailsView() {
private func loadPinDetailsView(_ annotation: MerchantAnnotation) {
self.titleView.text = "INTERSPORT"
self.nameImageView.image = UIImage(named: "intersport")
self.nameView.text = "Intersport Χαλάνδρι"
......@@ -162,7 +165,8 @@ class MapsViewController: UIViewController, MKMapViewDelegate {
}
func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) {
loadPinDetailsView()
let merchant = view.annotation as? MerchantAnnotation
loadPinDetailsView(merchant!)
showPinDetailsView()
}
......
......@@ -118,6 +118,9 @@
<rect key="frame" x="317" y="235" width="67" height="31"/>
<state key="normal" title="Button"/>
<buttonConfiguration key="configuration" style="plain" title="Button"/>
<connections>
<action selector="directionsButtomAction:" destination="-1" eventType="touchUpInside" id="nMR-Jk-Wm4"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="Δευτέρα - Τετάρτη" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="u9U-A7-lbO" userLabel="HoursLabel">
<rect key="frame" x="70" y="94" width="314" height="18"/>
......
//
// MerchantAnnotation.swift
// SwiftWarplyFramework
//
// Created by Βασιλης Σκουρας on 11/9/22.
//
import Foundation
import MapKit
class MerchantAnnotation: NSObject, MKAnnotation {
let model: swiftApi.MerchantModel
let coordinate: CLLocationCoordinate2D
init(_ model: swiftApi.MerchantModel) {
self.model = model
self.coordinate = CLLocationCoordinate2D(latitude: model._latitude, longitude: model._longitude)
super.init()
}
}