A Swift SDK for working with Salesforce church data, made for The King's Temple Church (TKT Church).
CongregationKit is a Swift package that helps you connect your app or server to Salesforce and work with church member data. It is designed for The King's Temple Church (TKT Church), but others can use it as a reference.
- Lets you log in to Salesforce using your username and password
- Lets you fetch and work with church member data from Salesforce
- Lets you choose which parts of member data you want (like contact info, employment, marital, or discipleship info)
- Works with async/await in Swift
- Can be used on macOS or iOS, and with server frameworks like Vapor
Add CongregationKit to your Package.swift:
dependencies: [
.package(url: "https://github.com/tktchurch/CongregationKit.git", from: "1.0.0")
]Or in Xcode:
- File → Add Package Dependencies
- Enter the repository URL
- Select the version you want
import CongregationKit
let credentials = SalesforceCredentials(
clientId: "your_client_id",
clientSecret: "your_client_secret",
username: "your_salesforce_username",
password: "your_salesforce_password"
)import AsyncHTTPClient
let httpClient = HTTPClient.shared
let congregation = try await CongregationKit(httpClient: httpClient, credentials: credentials)import SalesforceClient // for MemberExpand
let expanded: [MemberExpand] = [
.contactInformation,
.employmentInformation,
.maritalInformation,
.discipleshipInformation
]
let response = try await congregation.salesforceClient.members.fetchAll(
accessToken: congregation.salesforceClient.auth.accessToken,
instanceUrl: congregation.salesforceClient.auth.instanceUrl,
pageNumber: 1,
pageSize: 50,
expanded: expanded
)
for member in response.members {
print(member.memberName)
print(member.contactInformation?.email)
print(member.employmentInformation?.occupation)
print(member.maritalInformation?.maritalStatus)
print(member.discipleshipInformation?.waterBaptism?.date)
}let member = try await congregation.salesforceClient.members.fetch(
memberId: someMemberID,
accessToken: congregation.salesforceClient.auth.accessToken,
instanceUrl: congregation.salesforceClient.auth.instanceUrl,
expanded: [.discipleshipInformation, .contactInformation]
)
if let discipleship = member.discipleshipInformation {
print(discipleship.waterBaptism?.date)
}When you fetch members, you can choose which parts of their data you want by passing an array of MemberExpand values. If you don't ask for a part, it will be nil in the result. This makes things faster and keeps your app simple.
| Expansion | Property on Member |
|---|---|
.contactInformation |
member.contactInformation |
.employmentInformation |
member.employmentInformation |
.maritalInformation |
member.maritalInformation |
.discipleshipInformation |
member.discipleshipInformation |
SalesforceAuthError(login or network problems)MemberError(not found, invalid data, etc.)
- Swift 6.0+
- macOS 14.0+ / iOS 15.0+
- Xcode 15.0+
MIT License. See LICENSE for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
For support and questions, please open an issue on GitHub or contact the development team.