Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Added Swift 3 Examples #35

Merged
merged 17 commits into from
Dec 7, 2016
Merged

Added Swift 3 Examples #35

merged 17 commits into from
Dec 7, 2016

Conversation

jmkiley
Copy link
Contributor

@jmkiley jmkiley commented Oct 27, 2016

  • Added Swift 3.0 examples for each code example
  • Added Swift 2.3 build target as well as Swift 3.0

CC: @friedbunny

@jmkiley jmkiley self-assigned this Oct 27, 2016
Copy link
Contributor Author

@jmkiley jmkiley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Renamed some files to clarify version of Swift

@jmkiley jmkiley closed this Oct 27, 2016
@friedbunny friedbunny reopened this Oct 27, 2016
Copy link
Contributor

@friedbunny friedbunny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like some of the .swift files ended up in the /Objective-C folder (on disk, rather than in the project). Let’s consolidate all of the .swift files in the /Swift folder.

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These files in /xcuserdata got committed accidentally — let’s remove them from this PR and add full macOS and Xcode exclusions to .gitignore.

Copy link

@boundsj boundsj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking 👍 so far! I'm interested to see how the ExampleProtocol evolves

//
// Created by Jordan Kiley on 10/27/16.
// Copyright © 2016 Mapbox. All rights reserved.
//
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove these generated comments

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve left them in the project so far, but this could be a task we do across all files before this project reaches a wider audience.

import Mapbox

@objc(CustomAnnotationModelExample_Swift)

class CustomAnnotationModelExample_Swift: UIViewController, MGLMapViewDelegate {
override func viewDidLoad() {
super.viewDidLoad()

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: It looks like Xcode on your system is adding whitespace

@@ -575,7 +605,7 @@
TargetAttributes = {
9619628B1C581700002D3DAB = {
CreatedOnToolsVersion = 7.3;
DevelopmentTeam = U8B2JGE4C6;
DevelopmentTeam = 85826LGZGV;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noting this got checked in. Not a big deal and I'm not actually sure what is correct for this project.

@@ -27,6 +27,8 @@
3ECF46101DC1871B0089118A /* SatelliteStyleExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ECF460F1DC1871B0089118A /* SatelliteStyleExample.swift */; };
3ECF46121DC1874D0089118A /* SimpleMapViewExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ECF46111DC1874D0089118A /* SimpleMapViewExample.swift */; };
3ECF46141DC1878F0089118A /* UserTrackingModesExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ECF46131DC1878F0089118A /* UserTrackingModesExample.swift */; };
3ECF46151DC18DAA0089118A /* CustomAnnotationModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3ECF45F11DC176090089118A /* CustomAnnotationModels.swift */; };
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😁 feel free to add more details in the commit message to for reviewers with less context about the problem you fixed (i.e. added ____ and ____ files to the ___ target)

MBXExampleSimpleMapView,
MBXExampleUserTrackingModes,
]];
Copy link
Contributor

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.

CLLocationCoordinate2DMake(0, 33),
CLLocationCoordinate2DMake(0, 66),
CLLocationCoordinate2DMake(0, 99),
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: align the indentation of the closing bracket with let.

@@ -31,15 +31,15 @@ class CustomAnnotationModelExample_Swift: UIViewController, MGLMapViewDelegate {
CLLocationCoordinate2DMake(-15, 0),
CLLocationCoordinate2DMake(-45, 10),
CLLocationCoordinate2DMake(-45, 40),
]

]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: align the indentation of the closing bracket with var.

CLLocationCoordinate2DMake(0, 0),
CLLocationCoordinate2DMake(0, 35),
CLLocationCoordinate2DMake(0, 70),
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: align the indentation of the closing bracket with let.

UIView.animate(withDuration: 0.3, delay: 0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0, options: [], animations: {
self.layer.opacity = 0.8
self.transform = CGAffineTransform.identity.scaledBy(x: 1.5, y: 1.5)
}, completion: nil)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: align the indentation of this closing brace with UIView.

let context = NSKeyedArchiver.archivedData(withRootObject: userInfo)



Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let’s trim the excess blank lines here.




.lightGray
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m kind of amazed that this works, lol.

class AnnotationViewExample_Swift: UIViewController, MGLMapViewDelegate {

// #if !swift(>=3.0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don’t need this, let’s remove it.

}

//
// MGLAnnotationView subclass
class CustomAnnotationView: MGLAnnotationView {
// #if !swift(>=3.0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let’s remove this if we don’t need it.

CLLocationCoordinate2DMake(-15, 0),
CLLocationCoordinate2DMake(-45, 10),
CLLocationCoordinate2DMake(-45, 40),
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: align this closing brace with var.

@friedbunny
Copy link
Contributor

Thanks for beavering away on this. I think we’re good to merge and then address any potential style or organization issues as we notice them. :shipit:

@jmkiley jmkiley merged commit cbbf75e into master Dec 7, 2016
@friedbunny friedbunny deleted the swift3 branch December 8, 2016 00:45
@1ec5 1ec5 mentioned this pull request Dec 19, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants