Skip to content

Commit e6c2db2

Browse files
authored
docs: add Playground configuration changes (#312)
* docs: add Playground configuration changes * update playgrounds * Update playgrounds
1 parent e9ba846 commit e6c2db2

File tree

3 files changed

+109
-15
lines changed

3 files changed

+109
-15
lines changed

CONTRIBUTING.md

Lines changed: 100 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,58 @@
1-
# Contributing to the ParseSwift SDK
1+
# Contributing to the ParseSwift SDK <!-- omit in toc -->
2+
3+
## Table of Contents <!-- omit in toc -->
4+
- [Contributing](#contributing)
5+
- [Why Contributing?](#why-contributing)
6+
- [Environment Setup](#environment-setup)
7+
- [Setting up your local machine](#setting-up-your-local-machine)
8+
- [Swift Playgrounds](#swift-playgrounds)
9+
- [Please Do's](#please-dos)
10+
- [Pull Request](#pull-request)
11+
- [Evolution](#evolution)
12+
- [Code of Conduct](#code-of-conduct)
213

314
We really want the ParseSwift SDK to be yours, to see it grow and thrive in the open source community.
415

516
If you are not familiar with Pull Requests and want to know more about them, you can visit the [Creating a pull request](https://help.github.com/articles/creating-a-pull-request/) article. It contains detailed information about the process.
617

7-
## Setting up your local machine
18+
## Contributing
19+
20+
Before you start to code, please open a [new issue](https://github.com/parse-community/Parse-Swift/issues/new/choose) to describe your idea, or search for and continue the discussion in an [existing issue](https://github.com/parse-community/Parse-Swift/issues).
21+
22+
> ⚠️ Please do not post a security vulnerability on GitHub or in the Parse Community Forum. Instead, follow the [Parse Community Security Policy](https://github.com/parse-community/parse-server/security/policy).
23+
24+
Please completely fill out any templates to provide essential information about your new feature or the bug you discovered.
25+
26+
Together we will plan out the best conceptual approach for your contribution, so that your and our time is invested in the best possible approach. The discussion often reveals how to leverage existing features of ParseSwift SDK to reach your goal with even less effort and in a more sustainable way.
27+
28+
When you are ready to code, you can find more information about opening a pull request in the [GitHub docs](https://help.github.com/articles/creating-a-pull-request/).
29+
30+
Whether this is your first contribution or you are already an experienced contributor, the Parse Community has your back – don't hesitate to ask for help!
31+
32+
## Why Contributing?
33+
34+
Buy cheap, buy twice. What? No, this is not the Economics 101 class, but the same is true for contributing.
35+
36+
There are two ways of writing a feature or fixing a bug. Sometimes the quick solution is to just write a Cloud Code function that does what you want. Contributing by making the change directly in ParseSwift may take a bit longer, but it actually saves you much more time in the long run.
37+
38+
Consider the benefits you get:
39+
40+
- #### 🚀 Higher efficiency
41+
Your code is examined for efficiency and interoperability with existing features by the community.
42+
- #### 🛡 Stronger security
43+
Your code is scrutinized for bugs and vulnerabilities and automated checks help to identify security issues that may arise in the future.
44+
- #### 🧬 Continuous improvement
45+
If your feature is used by others it is likely to be continuously improved and extended by the community.
46+
- #### 💝 Giving back
47+
You give back to the community that contributed to make the Parse Platform become what it is today and for future developers to come.
48+
- #### 🧑‍🎓 Improving yourself
49+
You learn to better understand the inner workings of ParseSwift, which will help you to write more efficient and resilient code for your own application.
50+
51+
Most importantly, with every contribution you improve your skills so that future contributions take even less time and you get all the benefits above for free — easy choice, right?
52+
53+
## Environment Setup
54+
55+
### Setting up your local machine
856

957
* [Fork](https://github.com/parse-community/Parse-Swift) this project and clone the fork on to your local machine:
1058

@@ -19,11 +67,59 @@ $ cd Parse-Swift # go into the clone directory
1967
$ brew install swiftlint
2068
```
2169

22-
* Please see [this comment](https://github.com/parse-community/Parse-Swift/pull/12#issuecomment-656918156) for details on developing with and testing the SDK.
70+
### Swift Playgrounds
71+
72+
Any feature additions should work with a real Parse Server. You can experiment with features in the ParseSwift SDK by modifying the [ParseSwift Playground files](https://github.com/parse-community/Parse-Swift/tree/main/ParseSwift.playground/Pages). It is recommended to make sure your ParseSwift workspace in Xcode is set to build for `ParseSwift (macOS)` framework when using Swift Playgrounds. To configure the playgounds, you can do one of the following:
73+
74+
* Use the pre-configured parse-server in [this repo](https://github.com/netreconlab/parse-hipaa/tree/parse-swift) which comes with docker compose files (`docker-compose up` gives you a working server) configured to connect with the ParseSwift Playgrounds. The docker comes with [Parse Dashboard](https://github.com/parse-community/parse-dashboard) and can be used with MongoDB or PostgreSQL.
75+
* Configure the ParseSwift Playgrounds to work with your own Parse Server by editing the configuation in [Common.swift](https://github.com/parse-community/Parse-Swift/blob/e9ba846c399257100b285d25d2bd055628b13b4b/ParseSwift.playground/Sources/Common.swift#L4-L19).
76+
77+
### Please Do's
78+
79+
* Take testing seriously! Aim to increase the test coverage with every pull request
80+
* Add/modify test files for the code you are working on in [ParseSwiftTests](https://github.com/parse-community/Parse-Swift/tree/main/Tests/ParseSwiftTests)
81+
* Run the tests for the file you are working on using Xcode
82+
* Run the tests for the whole project to make sure the code passes all tests. This can be done by running the tests in Xcode
83+
* Address all errors and warnings your fixes introduce as the ParseSwift SDK should have zero warnings
84+
* Test your additions in Swift Playgrounds and add to the Playgrounds if applicable
85+
* Please consider if any changes to the [docs](http://docs.parseplatform.org) are needed or add additional sections in the case of an enhancement or feature.
86+
87+
## Pull Request
88+
89+
For release automation, the title of pull requests needs to be written in a defined syntax. We loosely follow the [Conventional Commits](https://www.conventionalcommits.org) specification, which defines this syntax:
90+
91+
```
92+
<type>: <summary>
93+
```
94+
95+
The _type_ is the category of change that is made, possible types are:
96+
- `feat` - add a new feature
97+
- `fix` - fix a bug
98+
- `refactor` - refactor code without impact on features or performance
99+
- `docs` - add or edit code comments, documentation, GitHub pages
100+
- `style` - edit code style
101+
- `build` - retry failing build and anything build process related
102+
- `perf` - performance optimization
103+
- `ci` - continuous integration
104+
- `test` - tests
105+
106+
The _summary_ is a short change description in present tense, not capitalized, without period at the end. This summary will also be used as the changelog entry.
107+
- It must be short and self-explanatory for a reader who does not see the details of the full pull request description
108+
- It must not contain abbreviations, e.g. instead of `LQ` write `LiveQuery`
109+
- It must use the correct product and feature names as referenced in the documentation, e.g. instead of `Cloud Validator` use `Cloud Function validation`
110+
- In case of a breaking change, the summary must not contain duplicate information that is also in the [BREAKING CHANGE](#breaking-change) chapter of the pull request description. It must not contain a note that it is a breaking change, as this will be automatically flagged as such if the pull request description contains the BREAKING CHANGE chapter.
111+
112+
For example:
113+
114+
```
115+
feat: add handle to door for easy opening
116+
```
117+
118+
Currently, we are not making use of the commit _scope_, which would be written as `<type>(<scope>): <summary>`, that attributes a change to a specific part of the product.
23119

24120
## Evolution
25121

26-
This SDK is still in it's early phases. It's not intended as a port of the Parse Objective-c SDK and has many new philosophies. Please see [this thread](https://github.com/parse-community/Parse-Swift/issues/3) for a detailed discussion about the intended evolution of this SDK.
122+
It's not intended as a port of the Parse Objective-c SDK and has many new philosophies. Please see [this thread](https://github.com/parse-community/Parse-Swift/issues/3) for a detailed discussion about the intended evolution of this SDK.
27123

28124
## Code of Conduct
29125

ParseSwift.playground/Pages/6 - Installation.xcplaygroundpage/Contents.swift

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,15 @@ struct Installation: ParseInstallation {
4141
/*: Save your first `customKey` value to your `ParseInstallation`.
4242
Performs work on background queue and returns to designated on
4343
designated callbackQueue. If no callbackQueue is specified it
44-
returns to main queue.
44+
returns to main queue. Note that this may be the first time you
45+
are saving your Installation.
4546
*/
46-
var currentInstallation = Installation.current
47-
currentInstallation?.customKey = "myCustomInstallationKey2"
47+
let currentInstallation = Installation.current
4848
currentInstallation?.save { results in
4949

5050
switch results {
5151
case .success(let updatedInstallation):
52-
currentInstallation = updatedInstallation
53-
print("Successfully save myCustomInstallationKey to ParseServer: \(updatedInstallation)")
52+
print("Successfully saved Installation to ParseServer: \(updatedInstallation)")
5453
case .failure(let error):
5554
print("Failed to update installation: \(error)")
5655
}
@@ -59,12 +58,11 @@ currentInstallation?.save { results in
5958
/*: Update your `ParseInstallation` `customKey` value.
6059
Performs work on background queue and returns to designated on
6160
designated callbackQueue. If no callbackQueue is specified it
62-
returns to main queue. Using `mutable` allows you to only
63-
send the updated keys to the parse server as opposed to the
64-
whole object.
61+
returns to main queue.
6562
*/
66-
currentInstallation?.customKey = "updatedValue"
67-
currentInstallation?.save { results in
63+
var installationToUpdate = Installation.current
64+
installationToUpdate?.customKey = "myCustomInstallationKey2"
65+
installationToUpdate?.save { results in
6866

6967
switch results {
7068
case .success(let updatedInstallation):

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ A pure Swift library that gives you access to the powerful Parse Server backend
2828

2929
For more information about the Parse Platform and its features, see the public [documentation][docs]. The ParseSwift SDK is not a port of the [Parse-SDK-iOS-OSX SDK](https://github.com/parse-community/Parse-SDK-iOS-OSX) and though some of it may feel familiar, it is not backwards compatible and is designed with a new philosophy. For more details visit the [api documentation](http://parseplatform.org/Parse-Swift/api/).
3030

31-
To learn how to use or experiment with ParseSwift, you can run and edit the [ParseSwift.playground](https://github.com/parse-community/Parse-Swift/tree/main/ParseSwift.playground/Pages). You can use the parse-server in [this repo](https://github.com/netreconlab/parse-hipaa/tree/parse-swift) which has docker compose files (`docker-compose up` gives you a working server) configured to connect with the playground files, has [Parse Dashboard](https://github.com/parse-community/parse-dashboard), and can be used with MongoDB or PostgreSQL.
31+
To learn how to use or experiment with ParseSwift, you can run and edit the [ParseSwift.playground](https://github.com/parse-community/Parse-Swift/tree/main/ParseSwift.playground/Pages). You can use the parse-server in [this repo](https://github.com/netreconlab/parse-hipaa/tree/parse-swift) which has docker compose files (`docker-compose up` gives you a working server) configured to connect with the playground files, has [Parse Dashboard](https://github.com/parse-community/parse-dashboard), and can be used with MongoDB or PostgreSQL. You can also configure the Swift Playgrounds to work with your own Parse Server by editing the configuation in [Common.swift](https://github.com/parse-community/Parse-Swift/blob/e9ba846c399257100b285d25d2bd055628b13b4b/ParseSwift.playground/Sources/Common.swift#L4-L19). To learn more, check out [CONTRIBUTING.md](https://github.com/parse-community/Parse-Swift/blob/main/CONTRIBUTING.md#swift-playgrounds).
3232

3333
---
3434

0 commit comments

Comments
 (0)