Skip to content

Commit

Permalink
Merge conflicts resolved.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Alirezaa committed Jul 17, 2019
2 parents a015708 + 004fdf2 commit a988fb2
Show file tree
Hide file tree
Showing 38 changed files with 3,079 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@ fastlane/screenshots/screenshots.html
# scan temporary files
fastlane/test_output

# End of https://www.gitignore.io/api/macos,xcode,carthage,cocoapods,fastlane
# End of https://www.gitignore.io/api/macos,xcode,carthage,cocoapods,fastlane
5 changes: 4 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ excluded: # paths to ignore during linting. Takes precedence over `included`.
- Example

disabled_rules: # rule identifiers to exclude from running
- trailing_whitespace
- trailing_whitespace
- nesting
- identifier_name
- file_length
1 change: 1 addition & 0 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github "raphaelmor/Polyline" ~> 4.2.1
1 change: 1 addition & 0 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github "raphaelmor/Polyline" "v4.2.1"
7 changes: 6 additions & 1 deletion Configs/MapirServices.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,14 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>iPhoneOS</string>
<string>iPhoneSimulator</string>
</array>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>
Expand Down
4 changes: 3 additions & 1 deletion Example/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>MAPIRAccessToken</key>
<string>sag</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
Expand All @@ -17,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
Expand Down
104 changes: 102 additions & 2 deletions Example/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 1398 Map. All rights reserved.
//

import CoreLocation
import UIKit
import MapirServices

Expand All @@ -19,22 +20,121 @@ class ViewController: UIViewController {
/// The Label
lazy var label: UILabel = {
let label = UILabel()
label.text = "🚀\nMapirServices\nExample"
label.text = "🚀\nMapirServices\nExample\nYou may watch your debbugin console :)"
label.font = .systemFont(ofSize: 25, weight: .semibold)
label.numberOfLines = 0
label.lineBreakMode = .byWordWrapping
label.textAlignment = .center
return label
}()

// MARK: Instance of MapirServices
let mps = MPSMapirServices.shared

// MARK: View-Lifecycle

/// View did load
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = .white

let coordinates = CLLocationCoordinate2D(latitude: 35.732527, longitude: 51.422710)
let size = CGSize(width: 300, height: 250)
let marker = MPSStaticMapMarker(coordinate: coordinates, style: MPSStaticMapMarker.Style.red, label: "mapir")

mps.getStaticMap(center: coordinates,
size: size,
zoomLevel: 15,
markers: [marker]) { (result) in

switch result{
case .failure(let error):
debugPrint(error.localizedDescription)
case .success(let image):
let backgroundImage = image
let uiImageView = UIImageView(image: backgroundImage)
uiImageView.frame.origin = CGPoint(x: self.view.frame.midX - uiImageView.frame.width / 2,
y: self.view.frame.maxY - uiImageView.frame.height - 50)
uiImageView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
self.view.insertSubview(uiImageView, belowSubview: self.view)
}
}

mps.getReverseGeocode(for: coordinates) { (result) in
switch result {
case .success(let reverse):
print("getReverseGeocode method for (\(coordinates.latitude), \(coordinates.longitude)) was successful.")
print("---> address is: \(reverse.address ?? "nil")")
case .failure(let error):
print("getReverseGeocode failed with error: \(error.localizedDescription)")
}
}

mps.getFastReverseGeocode(for: coordinates) { (result) in
switch result {
case .success(let reverse):
print("getFastReverseGeocode method for (\(coordinates.latitude), \(coordinates.longitude)) was successful.")
print("---> address is: \(reverse.address ?? "nil")")
case .failure(let error):
print("getFastReverseGeocode failed with error: \(error.localizedDescription)")
}
}

let pointA = CLLocationCoordinate2D(latitude: 35.732482, longitude: 51.422601)
let pointB = CLLocationCoordinate2D(latitude: 35.762794, longitude: 51.458094)
let pointC = CLLocationCoordinate2D(latitude: 35.771551, longitude: 51.439705)
let pointD = CLLocationCoordinate2D(latitude: 35.769149, longitude: 51.411467)

let origins = [pointA, pointB]
let destinations = [pointC, pointD]

mps.getDistanceMatrix(from: origins, to: destinations, options: .sorted) { (result) in
switch result {
case .failure(let error):
print("getDistanceMatrix failed with error: \(error.localizedDescription)")
case .success(let distanceMartix):
print("getDistanceMatrix method was successful.")
print("---> address is: \(distanceMartix)")
}
}

let stringToSearch = "ساوجی نیا"

mps.getSearchResult(for: stringToSearch, around: coordinates, selectionOptions: [.poi, .roads], filter: .city("تهران")) { (result) in
switch result {
case .success(let searchResult):
print("getSearchResult method was successful.")
print("---> Search result is: \(searchResult)")
case .failure(let error):
print("getSearchResult failed with error: \(error.localizedDescription)")
}
}

mps.getAutocompleteSearchResult(for: stringToSearch, around: coordinates, selectionOptions: [.poi, .roads]) { (result) in
switch result {
case .success(let searchResult):
print("getAutocompleteSearchResult method was successful.")
print("---> Autocomplete search result is: \(searchResult)")
case .failure(let error):
print("getAutocompleteSearchResult failed with error: \(error.localizedDescription)")
}
}

mps.getRoute(from: pointA,
to: [pointB, pointC],
routeType: .drivingNoExclusion,
routeOptions: .calculateAlternatives) { (result) in
switch result {
case .success(let route):
print("getRoute method was successful.")
print("---> Route result is: \(route)")
case .failure(let error):
print("getRoute failed with error: \(error)")
}
}

}

/// LoadView
override func loadView() {
self.view = self.label
Expand Down
43 changes: 32 additions & 11 deletions MapirServices.podspec
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
Pod::Spec.new do |s|

s.name = "MapirServices"
s.version = "1.0.0"
s.summary = "MapirServices"
s.homepage = "https://github.com/AlirezaAsadi/MapirServices"
s.version = "0.1.0"
s.summary = "a SDK to access services of map.ir."

s.homepage = "https://support.map.ir/"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Alireza Asadi" => "[email protected]" }
s.source = { :git => "https://github.com/AlirezaAsadi/MapirServices.git", :tag => s.version.to_s }
s.ios.deployment_target = "8.0"
s.tvos.deployment_target = "9.0"
s.watchos.deployment_target = "2.0"
s.osx.deployment_target = "10.10"
s.source_files = "Sources/**/*"
s.frameworks = "Foundation"

s.author = { "Map.ir" => "[email protected]" }
s.source = { :git => "https://github.com/map-ir/ios-sdk-v1-services-beta", :tag => s.version }

s.platform = :ios
s.ios.deployment_target = "10.0"
s.module_name = "MapirServiecs"

# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

s.source_files = "Sources/**/*.swift"

# ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

s.resources = ['MapirServices/Resources/*/*', 'MapirServices/Resources/*']

# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #

s.requires_arc = true

s.dependency "Polyline", "~> 4.2.1"

s.swift_version = '5.0'


s.frameworks = "Foundation", "CoreLocation"

end
Loading

0 comments on commit a988fb2

Please sign in to comment.