Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
mike4aday authored Mar 30, 2022
1 parent fa9b051 commit de1e288
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,31 @@
* Xcode 13

## Quick Start
Get up and running in less than 5 minutes:
Get up and running in less than 5 minutes!

1. **Get a free Salesforce Developer Edition:** You can sign up for a free developer environment (also called an "organization" or "org") [here](https://developer.salesforce.com/signup). It will never expire as long as you log in at least once every 6 months.

2. **Create a Salesforce Connected App:** Create a new [Connected App](https://help.salesforce.com/articleView?id=sf.connected_app_create.htm&type=5) in your developer environment. [This screenshot](https://mike4aday.github.io/SwiftlySalesforce/images/ConnectedAppDefinition.png) shows an example; you can copy the settings that I've entered. Be sure that "Require Secret for Refresh Token Flow" is *not* checked.

3. **Add Swiftly Salesforce to your project:** Add the Swiftly Salesforce package to your Xcode project, according to [these instructions](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app), and using the URL https://github.com/mike4aday/SwiftlySalesforce.git.
3. **Add Swiftly Salesforce to your project:** Add the Swiftly Salesforce package to your Xcode project ([instructions](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app)) with the URL https://github.com/mike4aday/SwiftlySalesforce.git.

4. **Create a configuration file:** In your Xcode project, create an empty file named [`Salesforce.json`](https://github.com/mike4aday/MySalesforceAccounts/blob/51cda01bc5c867643a9ef5085ede05e91151dfda/MySalesforceAccounts/Salesforce.json) and add the following JSON text, and replace the placeholder text with the actual values for your Connected App's consumer key and callback URL:
4. **Create a configuration file:** In your Xcode project, create an empty file named [`Salesforce.json`](https://github.com/mike4aday/MySalesforceAccounts/blob/51cda01bc5c867643a9ef5085ede05e91151dfda/MySalesforceAccounts/Salesforce.json) and add the following JSON text, replacing the placeholder text with the actual values for your Connected App's consumer key and callback URL:
```json
{
"consumerKey" : "<Replace with the consumer key from your Connected App definition>",
"callbackURL" : "<Replace with the callback URL from your Connected App definition>"
}
```

5. **Connect to Salesforce:** Create a `Connection` instance and you're ready to go! If you're using SwiftUI, you could call the following from your main application file and store the Salesforce connection in the environment. Swiftly Salesforce will automatically handle all the OAuth flows, authenticating users on their first use of your app and then silently refreshing their access tokens when required.
5. **Connect to Salesforce:** Call [`Salesforce.connect()`](https://github.com/mike4aday/SwiftlySalesforce/blob/fa9b051a9c857b09ae17b091a5db7210fa1dedd4/Sources/SwiftlySalesforce/Salesforce.swift#L5) and you're ready to go! If you're using SwiftUI, you could call the following from your main application file and store the Salesforce connection in the environment. Swiftly Salesforce will automatically handle all the OAuth flows, authenticating users on their first use of your app and then silently refreshing their access tokens when required.

```swift
// MySalesforceAccountsApp.swift
// MyApp.swift
import SwiftUI
import SwiftlySalesforce

@main
struct MySalesforceAccountsApp: App {
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView().environmentObject(try! Salesforce.connect())
Expand Down Expand Up @@ -98,10 +98,7 @@ Swiftly Salesforce will automatically manage all required Salesforce [authorizat
## Sample App
Check out [MySalesforceAccounts](https://github.com/mike4aday/MySalesforceAccounts) for a complete, working app that uses [SwiftUI](https://developer.apple.com/documentation/swiftui/), [Swift concurrency](https://developer.apple.com/news/?id=2o3euotz) and Swiftly Salesforce to display the user's Salesforce account records. Though it's a relatively-trival app, it illustrates how to configure an app and quickly connect it to Salesforce.

Before you run the sample app, edit [Salesforce.json](https://github.com/mike4aday/MySalesforceAccounts/blob/51cda01bc5c867643a9ef5085ede05e91151dfda/MySalesforceAccounts/Salesforce.json) and replace the temporary values for the consumer key and callback URL with those of your own Connected App.

## Online Documentation
Comning soon.
Before you run the sample app, edit [Salesforce.json](https://github.com/mike4aday/MySalesforceAccounts/blob/51cda01bc5c867643a9ef5085ede05e91151dfda/MySalesforceAccounts/Salesforce.json) and replace the temporary values for the consumer key and callback URL with those of your own Connected App.

## Questions, Suggestions & Bug Reports
* Open a [GitHub issue](https://github.com/mike4aday/SwiftlySalesforce/issues/new)
Expand Down

0 comments on commit de1e288

Please sign in to comment.