This repository has been archived by the owner on Jun 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 35
Merged
Changes from 12 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
657fa51
Create separate Swift 2.3 target/scheme
friedbunny b602645
Use the same Info.plist for both targets
friedbunny a69929e
Swift 3.0 updates
9aabeb0
typo fix
21897a7
Copied CustomPolyline class into AnnotationModel file
924ba3c
checked the ticky box and it fixed the problem
b85496f
files organized by language
jmkiley 9d751fa
removed .ds_store
jmkiley 2f59504
Removed incomplete files & unnecessary whitespace
jmkiley 1b30288
Removed .DS_Store and xcuserdata
jmkiley fd45213
Update .gitignore
jmkiley 7a498b0
Removed undeclared class
jmkiley 54444cf
Fixed .lightGray space
jmkiley f635332
Reorganized files, cleaned up whitespace
jmkiley 4cecf5f
Additional whitespace/comment cleanup
jmkiley ceb4a12
Fixed a few spacing issues
633f3f2
resolved merge conflict in command line
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
Mapbox.framework | ||
Examples.xcodeproj/project.xcworkspace/ | ||
|
||
.DS_Store | ||
xcuserdata/ | ||
DerivedData/ |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,3 @@ | |
|
||
|
||
@end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
// | ||
// AnnotationViewExample.swift | ||
// Examples | ||
// | ||
// Created by Jason Wray on 6/23/16. | ||
// Copyright © 2016 Mapbox. All rights reserved. | ||
// | ||
#if swift(>=3.0) | ||
import Mapbox | ||
|
||
@objc(AnnotationViewExample_Swift) | ||
|
||
// Example view controller | ||
class AnnotationViewExample_Swift: UIViewController, MGLMapViewDelegate { | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
exampleType = .Annotation | ||
print(exampleType) | ||
let mapView = MGLMapView(frame: view.bounds) | ||
mapView.autoresizingMask = [.flexibleWidth, .flexibleHeight] | ||
mapView.styleURL = MGLStyle.darkStyleURL(withVersion: 9) | ||
mapView.tintColor = .lightGray | ||
mapView.centerCoordinate = CLLocationCoordinate2DMake(0, 66) | ||
mapView.zoomLevel = 2 | ||
mapView.delegate = self | ||
view.addSubview(mapView) | ||
|
||
// Specify coordinates for our annotations. | ||
let coordinates = [ | ||
CLLocationCoordinate2DMake(0, 33), | ||
CLLocationCoordinate2DMake(0, 66), | ||
CLLocationCoordinate2DMake(0, 99), | ||
] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: align the indentation of the closing bracket with |
||
|
||
// Fill an array with point annotations and add it to the map. | ||
var pointAnnotations = [MGLPointAnnotation]() | ||
for coordinate in coordinates { | ||
let point = MGLPointAnnotation() | ||
point.coordinate = coordinate | ||
point.title = "\(coordinate.latitude), \(coordinate.longitude)" | ||
pointAnnotations.append(point) | ||
} | ||
|
||
mapView.addAnnotations(pointAnnotations) | ||
} | ||
|
||
// MARK: - MGLMapViewDelegate methods | ||
|
||
// This delegate method is where you tell the map to load a view for a specific annotation. To load a static MGLAnnotationImage, you would use `-mapView:imageForAnnotation:`. | ||
func mapView(_ mapView: MGLMapView, viewFor annotation: MGLAnnotation) -> MGLAnnotationView? { | ||
// This example is only concerned with point annotations. | ||
guard annotation is MGLPointAnnotation else { | ||
return nil | ||
} | ||
|
||
// Use the point annotation’s longitude value (as a string) as the reuse identifier for its view. | ||
let reuseIdentifier = "\(annotation.coordinate.longitude)" | ||
|
||
// For better performance, always try to reuse existing annotations. | ||
var annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: reuseIdentifier) | ||
|
||
// If there’s no reusable annotation view available, initialize a new one. | ||
if annotationView == nil { | ||
annotationView = CustomAnnotationView(reuseIdentifier: reuseIdentifier) | ||
annotationView!.frame = CGRect(x: 0, y: 0, width: 40, height: 40) | ||
|
||
// Set the annotation view’s background color to a value determined by its longitude. | ||
let hue = CGFloat(annotation.coordinate.longitude) / 100 | ||
annotationView!.backgroundColor = UIColor(hue: hue, saturation: 0.5, brightness: 1, alpha: 1) | ||
} | ||
|
||
return annotationView | ||
} | ||
|
||
func mapView(_ mapView: MGLMapView, annotationCanShowCallout annotation: MGLAnnotation) -> Bool { | ||
return true | ||
} | ||
} | ||
|
||
// | ||
// MGLAnnotationView subclass | ||
class CustomAnnotationView: MGLAnnotationView { | ||
override func layoutSubviews() { | ||
super.layoutSubviews() | ||
|
||
// Force the annotation view to maintain a constant size when the map is tilted. | ||
scalesWithViewingDistance = false | ||
|
||
// Use CALayer’s corner radius to turn this view into a circle. | ||
layer.cornerRadius = frame.width / 2 | ||
layer.borderWidth = 2 | ||
layer.borderColor = UIColor.white.cgColor | ||
} | ||
|
||
override func setSelected(_ selected: Bool, animated: Bool) { | ||
super.setSelected(selected, animated: animated) | ||
|
||
// Animate the border width in/out, creating an iris effect. | ||
let animation = CABasicAnimation(keyPath: "borderWidth") | ||
animation.duration = 0.1 | ||
layer.borderWidth = selected ? frame.width / 4 : 2 | ||
layer.add(animation, forKey: "borderWidth") | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s manually go back to the shorter indentation.