Skip to content

Commit 91424fb

Browse files
authored
Create CONTRIBUTING.md
1 parent fcc33ed commit 91424fb

File tree

1 file changed

+77
-0
lines changed

1 file changed

+77
-0
lines changed

CONTRIBUTING.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Contributing to the Mapbox Directions for Swift
2+
3+
## Reporting an issue
4+
5+
Bug reports and feature requests are more than welcome, but please consider the following tips so we can respond to your feedback more effectively.
6+
7+
Before reporting a bug here, please determine whether the issue lies with the MapboxDirections package or with another Mapbox product:
8+
9+
* For general questions and troubleshooting help, please contact the [Mapbox support](https://www.mapbox.com/contact/support/) team.
10+
* Report problems with the map’s contents or routing problems, especially problems specific to a particular route or region, using the [Mapbox Feedback](https://apps.mapbox.com/feedback/) tool.
11+
* Report problems in guidance instructions in the [OSRM Text Instructions](https://github.com/Project-OSRM/osrm-text-instructions/) repository (for Directions API profiles powered by OSRM) or the [Valhalla](https://github.com/valhalla/valhalla/) repository (for profiles powered by Valhalla).
12+
13+
When reporting a bug in the client-side MapboxDirections package, please indicate:
14+
15+
* The version of MapboxDirections you installed
16+
* The version of CocoaPods, Carthage, or Swift Package Manager that you used to install the package
17+
* The version of Xcode you used to build the package
18+
* The operating system version and device model on which you experienced the issue
19+
* Any relevant settings in `RouteOptions` or `MatchOptions`
20+
21+
## Setting up a development environment
22+
23+
To contribute code changes to this project, use either Carthage or Swift Package Manager to set up a development environment. Carthage and the Xcode project in this repository are important for Apple platforms, particularly for making sure dependent projects can use Carthage. Swift Package Manager is particularly important for Linux.
24+
25+
### Using Carthage
26+
27+
1. Install Xcode 12 and [Carthage](https://github.com/Carthage/Carthage/) v0.35 or above.
28+
1. Run `./scripts/wcarthage.sh bootstrap --cache-builds`. (wcarthage.sh is a temporary workaround for [a linker error in Xcode 12](https://github.com/Carthage/Carthage/issues/3019).)
29+
1. Once the Carthage build finishes, open MapboxDirections.xcodeproj in Xcode and build the MapboxDirections Mac scheme. Switch to the Example scheme to see the Mapbox Directions API in action on iOS.
30+
31+
### Using Swift Package Manager
32+
33+
In Xcode, go to Source Control ‣ Clone, enter `https://github.com/mapbox/mapbox-directions-swift.git`, and click Clone.
34+
35+
Alternatively, on the command line:
36+
37+
```bash
38+
git clone https://github.com/mapbox/mapbox-directions-swift.git
39+
cd mapbox-directions-swift/
40+
open Package.swift
41+
```
42+
43+
## Making any symbol public
44+
45+
To add any type, constant, or member to the package’s public interface:
46+
47+
1. Name the symbol according to [Swift design guidelines](https://swift.org/documentation/api-design-guidelines/) and [Cocoa naming conventions](https://developer.apple.com/library/prerelease/content/documentation/Cocoa/Conceptual/CodingGuidelines/CodingGuidelines.html#//apple_ref/doc/uid/10000146i). This library does not bridge to Objective-C, so the Swift design guidelines matter more than the traditional Cocoa naming conventions. Either way, this package often intentionally differs from the vocabulary and structure of the Mapbox Directions API.
48+
1. Provide full documentation comments. We use [jazzy](https://github.com/realm/jazzy/) to produce the documentation found [on the website for this package](https://docs.mapbox.com/ios/api/directions/). Many developers also rely on Xcode’s Quick Help feature, which supports a subset of Markdown.
49+
1. _(Optional.)_ Add the type or constant’s name to the relevant category in the `custom_categories` section of [the jazzy configuration file](./docs/jazzy.yml). This is required for classes and protocols and also recommended for any other type that is strongly associated with a particular class or protocol. If you leave out this step, the symbol will appear in an “Other” section in the generated HTML documentation’s table of contents.
50+
51+
## Adding tests
52+
53+
### Adding a test suite
54+
55+
1. Add a file to Tests/MapboxDirectionsTests/
56+
1. Add a file reference to the MapboxDirectionsTests group in MapboxDirections.xcodeproj.
57+
1. Rerun `swift test --generate-linuxmain`, which updates [XCTestManifests.swift](./Tests/MapboxDirectionsTests/XCTestManifests.swift) for builds that use Swift Package Manager.
58+
59+
### Adding a test case
60+
61+
1. Add a `test*` method to one of the classes in one of the files in [Tests/MapboxDirectionsTests/](./Tests/MapboxDirectionsTests/).
62+
1. Rerun `swift test --generate-linuxmain`, which updates [XCTestManifests.swift](./Tests/MapboxDirectionsTests/XCTestManifests.swift) for builds that use Swift Package Manager.
63+
64+
### Adding a test fixture
65+
66+
1. Add a file to [Tests/MapboxDirectionsTests/Fixtures/](./Tests/MapboxDirectionsTests/Fixtures/).
67+
1. Inside a test case, call `Fixture.stringFromFileNamed(name:)` or `Fixture.JSONFromFileNamed(name:)`.
68+
69+
### Running unit tests
70+
71+
Go to Product ‣ Test in Xcode, or run `swift test` on the command line.
72+
73+
## Opening a pull request
74+
75+
Pull requests are appreciated. If your PR includes any changes that would impact developers or end users, please mention those changes in the “main” section of [CHANGELOG.md](CHANGELOG.md), noting the PR number. Examples of noteworthy changes include new features, fixes for user-visible bugs, and renamed or deleted public symbols.
76+
77+
Before we can merge your PR, it must pass automated continuous integration checks on each of the supported platforms, as well as a check to ensure that code coverage has not decreased significantly.

0 commit comments

Comments
 (0)