Skip to content

Commit 8c58ad2

Browse files
authored
fix: ambiguous SDK initializer (#6)
* fix: ambiguous SDK initializer * bump version * nits * fix codecov
1 parent c84b036 commit 8c58ad2

File tree

7 files changed

+56
-22
lines changed

7 files changed

+56
-22
lines changed

CHANGELOG.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
# Parse-Swift Changelog
22

33
### main
4-
[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/4.15.0...main), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/main/documentation/parseswift)
4+
[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/4.15.1...main), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/main/documentation/parseswift)
55
* _Contributing to this repo? Add info about your change here to be included in the next release_
66

7+
### 4.15.1
8+
[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/4.15.0...4.15.1), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/4.15.1/documentation/parseswift)
9+
10+
__Fixes__
11+
- Fixed ambigous SDK initializer ([#6](https://github.com/netrecolab/Parse-Swift/pull/6)), thanks to [Corey Baker](https://github.com/cbaker6).
12+
713
### 4.15.0
814
[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/4.14.2...4.15.0), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/4.15.0/documentation/parseswift)
915

1016
__New features__
11-
- Addressed an issue that prevented updating ParseObjects with saveAll ([#2](https://github.com/netrecolab/Parse-Swift/pull/2)), thanks to [Corey Baker](https://github.com/cbaker6).
17+
- Refactored masterKey->primaryKey due to insensitive language ([#2](https://github.com/netrecolab/Parse-Swift/pull/2)), thanks to [Corey Baker](https://github.com/cbaker6).
1218

1319
### 4.14.2
1420
[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/4.14.1...4.14.2), [Documentation](https://swiftpackageindex.com/parse-community/Parse-Swift/4.14.2/documentation/parseswift)

CONTRIBUTING.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ If you are not familiar with Pull Requests and want to know more about them, you
1717

1818
## Contributing
1919

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).
20+
Before you start to code, please open a [new issue](https://github.com/netreconlab/Parse-Swift/issues/new/choose) to describe your idea, or search for and continue the discussion in an [existing issue](https://github.com/netreconlab/Parse-Swift/issues).
2121

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).
22+
> ⚠️ Please do not post a security vulnerability on GitHub. Instead, follow the [Security Policy](https://github.com/netreconlab/parse-server/security/policy).
2323
2424
Please completely fill out any templates to provide essential information about your new feature or the bug you discovered.
2525

2626
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.
2727

2828
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/).
2929

30-
Whether this is your first contribution or you are already an experienced contributor, the Parse Community has your back – do not hesitate to ask for help!
30+
Whether this is your first contribution or you are already an experienced contributor, do not hesitate to ask for help!
3131

3232
## Why Contributing?
3333

@@ -54,10 +54,10 @@ Most importantly, with every contribution you improve your skills so that future
5454

5555
### Setting up your local machine
5656

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

5959
```sh
60-
$ git clone https://github.com/parse-community/Parse-Swift
60+
$ git clone https://github.com/netreconlab/Parse-Swift
6161
$ cd Parse-Swift # go into the clone directory
6262
```
6363

@@ -69,15 +69,15 @@ $ brew install swiftlint
6969

7070
### Swift Playgrounds
7171

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:
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/netreconlab/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:
7373

7474
* 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).
75+
* Configure the ParseSwift Playgrounds to work with your own Parse Server by editing the configuation in [Common.swift](https://github.com/netreconlab/Parse-Swift/blob/e9ba846c399257100b285d25d2bd055628b13b4b/ParseSwift.playground/Sources/Common.swift#L4-L19).
7676

7777
### Please Do's
7878

7979
* 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)
80+
* Add/modify test files for the code you are working on in [ParseSwiftTests](https://github.com/netreconlab/Parse-Swift/tree/main/Tests/ParseSwiftTests)
8181
* Run the tests for the file you are working on using Xcode
8282
* 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
8383
* Address all errors and warnings your fixes introduce as the ParseSwift SDK should have zero warnings
@@ -120,7 +120,3 @@ Currently, we are not making use of the commit _scope_, which would be written a
120120
## Evolution
121121

122122
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 using [protocol oriented programming (POP) and value types](https://www.pluralsight.com/guides/protocol-oriented-programming-in-swift) instead of OOP and reference types. You can learn more about POP by watching [this](https://developer.apple.com/videos/play/wwdc2015/408/) or [that](https://developer.apple.com/videos/play/wwdc2016/419/) videos from previous WWDC's. Please see [this thread](https://github.com/parse-community/Parse-Swift/issues/3) for a detailed discussion about the intended evolution of this SDK.
123-
124-
## Code of Conduct
125-
126-
This project adheres to the [Contributor Covenant Code of Conduct](https://github.com/parse-community/.github/blob/main/CODE_OF_CONDUCT.md). By participating, you are expected to honor this code.

ParseSwift-macOS/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<key>CFBundleVersion</key>
2020
<string>$(CURRENT_PROJECT_VERSION)</string>
2121
<key>NSHumanReadableCopyright</key>
22-
<string>Copyright © 2020 Parse Community. All rights reserved.</string>
22+
<string>Copyright © 2022 Network Reconnaissance Lab. All rights reserved.</string>
2323
<key>NSPrincipalClass</key>
2424
<string></string>
2525
</dict>

Sources/ParseSwift/Parse.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ public func initialize(
316316
public func initialize(
317317
applicationId: String,
318318
clientKey: String? = nil,
319-
masterKey: String? = nil,
319+
masterKey: String,
320320
serverURL: URL,
321321
liveQueryServerURL: URL? = nil,
322322
requiringCustomObjectIds: Bool = false,
@@ -429,7 +429,7 @@ public func initialize(
429429
) {
430430
initialize(applicationId: applicationId,
431431
clientKey: clientKey,
432-
masterKey: masterKey,
432+
primaryKey: masterKey,
433433
serverURL: serverURL,
434434
liveQueryServerURL: liveQueryServerURL,
435435
requiringCustomObjectIds: allowingCustomObjectIds,
@@ -523,7 +523,7 @@ public func initialize(
523523
) {
524524
var configuration = ParseConfiguration(applicationId: applicationId,
525525
clientKey: clientKey,
526-
masterKey: masterKey,
526+
primaryKey: masterKey,
527527
serverURL: serverURL,
528528
liveQueryServerURL: liveQueryServerURL,
529529
requiringCustomObjectIds: allowingCustomObjectIds,

Sources/ParseSwift/ParseConstants.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010

1111
enum ParseConstants {
1212
static let sdk = "swift"
13-
static let version = "4.14.2"
13+
static let version = "4.15.1"
1414
static let fileManagementDirectory = "parse/"
1515
static let fileManagementPrivateDocumentsDirectory = "Private Documents/"
1616
static let fileManagementLibraryDirectory = "Library/"

Sources/ParseSwift/Types/ParseConfiguration.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public struct ParseConfiguration {
262262
@available(*, deprecated, message: "Change: masterKey->primaryKey.")
263263
public init(applicationId: String,
264264
clientKey: String? = nil,
265-
masterKey: String? = nil,
265+
masterKey: String,
266266
webhookKey: String? = nil,
267267
serverURL: URL,
268268
liveQueryServerURL: URL? = nil,
@@ -374,7 +374,7 @@ public struct ParseConfiguration {
374374
URLCredential?) -> Void) -> Void)? = nil) {
375375
self.init(applicationId: applicationId,
376376
clientKey: clientKey,
377-
masterKey: masterKey,
377+
primaryKey: masterKey,
378378
webhookKey: webhookKey,
379379
serverURL: serverURL,
380380
liveQueryServerURL: liveQueryServerURL,
@@ -467,7 +467,7 @@ public struct ParseConfiguration {
467467
URLCredential?) -> Void) -> Void)? = nil) {
468468
self.init(applicationId: applicationId,
469469
clientKey: clientKey,
470-
masterKey: masterKey,
470+
primaryKey: masterKey,
471471
webhookKey: webhookKey,
472472
serverURL: serverURL,
473473
liveQueryServerURL: liveQueryServerURL,

Tests/ParseSwiftTests/InitializeSDKTests.swift

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,38 @@ class InitializeSDKTests: XCTestCase {
9898
XCTAssertNotNil(Parse.sessionDelegate.authentication)
9999
ParseSwift.updateAuthentication(nil)
100100
XCTAssertNil(Parse.sessionDelegate.authentication)
101+
102+
let configuration3 = ParseConfiguration(applicationId: "applicationId",
103+
clientKey: "clientKey",
104+
masterKey: "primaryKey",
105+
serverURL: url) { (_, credential) in
106+
credential(.performDefaultHandling, nil)
107+
}
108+
ParseSwift.initialize(configuration: configuration3)
109+
XCTAssertNotNil(Parse.sessionDelegate.authentication)
110+
ParseSwift.updateAuthentication(nil)
111+
XCTAssertNil(Parse.sessionDelegate.authentication)
112+
113+
ParseSwift.initialize(applicationId: "applicationId",
114+
clientKey: "clientKey",
115+
masterKey: "primaryKey",
116+
serverURL: url) { (_, credential) in
117+
credential(.performDefaultHandling, nil)
118+
}
119+
XCTAssertNotNil(Parse.sessionDelegate.authentication)
120+
ParseSwift.updateAuthentication(nil)
121+
XCTAssertNil(Parse.sessionDelegate.authentication)
122+
123+
ParseSwift.initialize(applicationId: "applicationId",
124+
clientKey: "clientKey",
125+
masterKey: "primaryKey",
126+
serverURL: url,
127+
migratingFromObjcSDK: false) { (_, credential) in
128+
credential(.performDefaultHandling, nil)
129+
}
130+
XCTAssertNotNil(Parse.sessionDelegate.authentication)
131+
ParseSwift.updateAuthentication(nil)
132+
XCTAssertNil(Parse.sessionDelegate.authentication)
101133
}
102134

103135
#if !os(Linux) && !os(Android) && !os(Windows)

0 commit comments

Comments
 (0)