Showing
4 changed files
with
37 additions
and
5 deletions
| ... | @@ -35,6 +35,7 @@ | ... | @@ -35,6 +35,7 @@ |
| 35 | A079367E2885F60A00064122 /* AnalysisHeaderMessageViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A079367D2885F60A00064122 /* AnalysisHeaderMessageViewCell.swift */; }; | 35 | A079367E2885F60A00064122 /* AnalysisHeaderMessageViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A079367D2885F60A00064122 /* AnalysisHeaderMessageViewCell.swift */; }; |
| 36 | A080CFD628D170A20045A315 /* MapsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A080CFD428D170A20045A315 /* MapsViewController.swift */; }; | 36 | A080CFD628D170A20045A315 /* MapsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A080CFD428D170A20045A315 /* MapsViewController.swift */; }; |
| 37 | A080CFD728D170A20045A315 /* MapsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A080CFD528D170A20045A315 /* MapsViewController.xib */; }; | 37 | A080CFD728D170A20045A315 /* MapsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A080CFD528D170A20045A315 /* MapsViewController.xib */; }; |
| 38 | + A080CFDA28D1889A0045A315 /* MerchantAnnotation.swift in Sources */ = {isa = PBXBuildFile; fileRef = A080CFD928D1889A0045A315 /* MerchantAnnotation.swift */; }; | ||
| 38 | A09DBCAE2888BA8100DD50B0 /* SharingHistoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A09DBCAD2888BA8100DD50B0 /* SharingHistoryViewController.swift */; }; | 39 | A09DBCAE2888BA8100DD50B0 /* SharingHistoryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A09DBCAD2888BA8100DD50B0 /* SharingHistoryViewController.swift */; }; |
| 39 | E6A77853282933340045BBA8 /* SwiftWarplyFramework.docc in Sources */ = {isa = PBXBuildFile; fileRef = E6A77852282933340045BBA8 /* SwiftWarplyFramework.docc */; }; | 40 | E6A77853282933340045BBA8 /* SwiftWarplyFramework.docc in Sources */ = {isa = PBXBuildFile; fileRef = E6A77852282933340045BBA8 /* SwiftWarplyFramework.docc */; }; |
| 40 | E6A77854282933340045BBA8 /* SwiftWarplyFramework.h in Headers */ = {isa = PBXBuildFile; fileRef = E6A77851282933340045BBA8 /* SwiftWarplyFramework.h */; settings = {ATTRIBUTES = (Public, ); }; }; | 41 | E6A77854282933340045BBA8 /* SwiftWarplyFramework.h in Headers */ = {isa = PBXBuildFile; fileRef = E6A77851282933340045BBA8 /* SwiftWarplyFramework.h */; settings = {ATTRIBUTES = (Public, ); }; }; |
| ... | @@ -191,6 +192,7 @@ | ... | @@ -191,6 +192,7 @@ |
| 191 | A079367D2885F60A00064122 /* AnalysisHeaderMessageViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalysisHeaderMessageViewCell.swift; sourceTree = "<group>"; }; | 192 | A079367D2885F60A00064122 /* AnalysisHeaderMessageViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnalysisHeaderMessageViewCell.swift; sourceTree = "<group>"; }; |
| 192 | A080CFD428D170A20045A315 /* MapsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapsViewController.swift; sourceTree = "<group>"; }; | 193 | A080CFD428D170A20045A315 /* MapsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapsViewController.swift; sourceTree = "<group>"; }; |
| 193 | A080CFD528D170A20045A315 /* MapsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MapsViewController.xib; sourceTree = "<group>"; }; | 194 | A080CFD528D170A20045A315 /* MapsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MapsViewController.xib; sourceTree = "<group>"; }; |
| 195 | + A080CFD928D1889A0045A315 /* MerchantAnnotation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MerchantAnnotation.swift; sourceTree = "<group>"; }; | ||
| 194 | A09DBCAD2888BA8100DD50B0 /* SharingHistoryViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SharingHistoryViewController.swift; sourceTree = "<group>"; }; | 196 | A09DBCAD2888BA8100DD50B0 /* SharingHistoryViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SharingHistoryViewController.swift; sourceTree = "<group>"; }; |
| 195 | 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>"; }; | 197 | 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>"; }; |
| 196 | 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>"; }; | 198 | 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 @@ | ... | @@ -382,6 +384,7 @@ |
| 382 | isa = PBXGroup; | 384 | isa = PBXGroup; |
| 383 | children = ( | 385 | children = ( |
| 384 | A07936722885E67400064122 /* AnalysisItem.swift */, | 386 | A07936722885E67400064122 /* AnalysisItem.swift */, |
| 387 | + A080CFD928D1889A0045A315 /* MerchantAnnotation.swift */, | ||
| 385 | ); | 388 | ); |
| 386 | name = models; | 389 | name = models; |
| 387 | sourceTree = "<group>"; | 390 | sourceTree = "<group>"; |
| ... | @@ -885,6 +888,7 @@ | ... | @@ -885,6 +888,7 @@ |
| 885 | 1E74838D28378AF40042A589 /* CouponBarcodeViewController.swift in Sources */, | 888 | 1E74838D28378AF40042A589 /* CouponBarcodeViewController.swift in Sources */, |
| 886 | E6A778F0282933E60045BBA8 /* WLNativeAdsCollectionMode.m in Sources */, | 889 | E6A778F0282933E60045BBA8 /* WLNativeAdsCollectionMode.m in Sources */, |
| 887 | E6A7791C282933E60045BBA8 /* WLSMSActionHandlerDeprecated.m in Sources */, | 890 | E6A7791C282933E60045BBA8 /* WLSMSActionHandlerDeprecated.m in Sources */, |
| 891 | + A080CFDA28D1889A0045A315 /* MerchantAnnotation.swift in Sources */, | ||
| 888 | E6A77934282933E70045BBA8 /* UIActivityIndicatorView+AFNetworking.m in Sources */, | 892 | E6A77934282933E70045BBA8 /* UIActivityIndicatorView+AFNetworking.m in Sources */, |
| 889 | E6A77A34282BB3BB0045BBA8 /* ActiveGiftsViewController.swift in Sources */, | 893 | E6A77A34282BB3BB0045BBA8 /* ActiveGiftsViewController.swift in Sources */, |
| 890 | E6A778E6282933E60045BBA8 /* MyEmptyClass.swift in Sources */, | 894 | E6A778E6282933E60045BBA8 /* MyEmptyClass.swift in Sources */, | ... | ... |
| ... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
| 2 | // MapsViewController.swift | 2 | // MapsViewController.swift |
| 3 | // SwiftWarplyFramework | 3 | // SwiftWarplyFramework |
| 4 | // | 4 | // |
| 5 | -// Created by Βασιλης Σκουρας on 14/9/22. | 5 | +// Created by Βασιλης Σκουρας on 10/9/22. |
| 6 | // | 6 | // |
| 7 | 7 | ||
| 8 | import UIKit | 8 | import UIKit |
| ... | @@ -110,15 +110,18 @@ class MapsViewController: UIViewController, MKMapViewDelegate { | ... | @@ -110,15 +110,18 @@ class MapsViewController: UIViewController, MKMapViewDelegate { |
| 110 | hidePinDetailsView() | 110 | hidePinDetailsView() |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | + @IBAction func directionsButtomAction(_ sender: Any) { | ||
| 114 | + | ||
| 115 | + } | ||
| 116 | + | ||
| 113 | private func loadMapPins() { | 117 | private func loadMapPins() { |
| 114 | for item in merchantsArray { | 118 | for item in merchantsArray { |
| 115 | - let pin = MKPointAnnotation() | 119 | + let pin = MerchantAnnotation(item) |
| 116 | - pin.coordinate = CLLocationCoordinate2D(latitude: item._latitude, longitude: item._longitude) | ||
| 117 | mapView.addAnnotation(pin) | 120 | mapView.addAnnotation(pin) |
| 118 | } | 121 | } |
| 119 | } | 122 | } |
| 120 | 123 | ||
| 121 | - private func loadPinDetailsView() { | 124 | + private func loadPinDetailsView(_ annotation: MerchantAnnotation) { |
| 122 | self.titleView.text = "INTERSPORT" | 125 | self.titleView.text = "INTERSPORT" |
| 123 | self.nameImageView.image = UIImage(named: "intersport") | 126 | self.nameImageView.image = UIImage(named: "intersport") |
| 124 | self.nameView.text = "Intersport Χαλάνδρι" | 127 | self.nameView.text = "Intersport Χαλάνδρι" |
| ... | @@ -162,7 +165,8 @@ class MapsViewController: UIViewController, MKMapViewDelegate { | ... | @@ -162,7 +165,8 @@ class MapsViewController: UIViewController, MKMapViewDelegate { |
| 162 | } | 165 | } |
| 163 | 166 | ||
| 164 | func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) { | 167 | func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) { |
| 165 | - loadPinDetailsView() | 168 | + let merchant = view.annotation as? MerchantAnnotation |
| 169 | + loadPinDetailsView(merchant!) | ||
| 166 | showPinDetailsView() | 170 | showPinDetailsView() |
| 167 | } | 171 | } |
| 168 | 172 | ... | ... |
| ... | @@ -118,6 +118,9 @@ | ... | @@ -118,6 +118,9 @@ |
| 118 | <rect key="frame" x="317" y="235" width="67" height="31"/> | 118 | <rect key="frame" x="317" y="235" width="67" height="31"/> |
| 119 | <state key="normal" title="Button"/> | 119 | <state key="normal" title="Button"/> |
| 120 | <buttonConfiguration key="configuration" style="plain" title="Button"/> | 120 | <buttonConfiguration key="configuration" style="plain" title="Button"/> |
| 121 | + <connections> | ||
| 122 | + <action selector="directionsButtomAction:" destination="-1" eventType="touchUpInside" id="nMR-Jk-Wm4"/> | ||
| 123 | + </connections> | ||
| 121 | </button> | 124 | </button> |
| 122 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="Δευτέρα - Τετάρτη" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="u9U-A7-lbO" userLabel="HoursLabel"> | 125 | <label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="Δευτέρα - Τετάρτη" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="u9U-A7-lbO" userLabel="HoursLabel"> |
| 123 | <rect key="frame" x="70" y="94" width="314" height="18"/> | 126 | <rect key="frame" x="70" y="94" width="314" height="18"/> | ... | ... |
| 1 | +// | ||
| 2 | +// MerchantAnnotation.swift | ||
| 3 | +// SwiftWarplyFramework | ||
| 4 | +// | ||
| 5 | +// Created by Βασιλης Σκουρας on 11/9/22. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +import Foundation | ||
| 9 | +import MapKit | ||
| 10 | + | ||
| 11 | +class MerchantAnnotation: NSObject, MKAnnotation { | ||
| 12 | + let model: swiftApi.MerchantModel | ||
| 13 | + let coordinate: CLLocationCoordinate2D | ||
| 14 | + | ||
| 15 | + init(_ model: swiftApi.MerchantModel) { | ||
| 16 | + self.model = model | ||
| 17 | + self.coordinate = CLLocationCoordinate2D(latitude: model._latitude, longitude: model._longitude) | ||
| 18 | + | ||
| 19 | + super.init() | ||
| 20 | + } | ||
| 21 | +} |
-
Please register or login to post a comment