Our complete rental property management API with secure authentication, property management, tenant tracking, and financial operations for internal iOS development.
Apple Sign-In integration with JWT tokens for secure API access
Complete CRUD operations for properties, rentals, and tenant management
Payment processing, balance management, and financial reporting
Implementation guide for our Apple Sign-In integration and JWT-based authentication system
import AuthenticationServices
// Present Apple Sign-In
let request = ASAuthorizationAppleIDProvider().createRequest()
request.requestedScopes = [.fullName, .email]
let controller = ASAuthorizationController(authorizationRequests: [request])
controller.delegate = self
controller.presentationContextProvider = self
controller.performRequests()
POST /api/auth/apple
{
"identityToken": "apple_identity_token_from_ios",
"user": {
"name": {
"firstName": "John",
"lastName": "Doe"
}
}
}
{
"success": true,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"isNewUser": false,
"user": {
"id": 123,
"email": "user@privaterelay.appleid.com",
"full_name": "John Doe",
"role": "user"
}
}
// Add JWT to request headers
var request = URLRequest(url: url)
request.setValue("Bearer \(jwtToken)", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
Complete REST API endpoints reference for our internal iOS rental management application
https://rentmanager.io/api
Apple Sign-In authentication for iOS
Refresh JWT access token
Logout and invalidate session
Get all properties for authenticated user
Create new property
Get property details by ID
Update property information
Delete property
Get all rental agreements
Create new rental agreement
Get agreement details
Generate agreement PDF
Get user account balance
Get transaction history
Process payment
Get invoices list
Swift code examples and implementation patterns for our development team
import Foundation
class RentManagerAPI {
static let shared = RentManagerAPI()
private let baseURL = "https://rentmanager.io/api"
private var jwtToken: String?
private init() {}
func setAuthToken(_ token: String) {
self.jwtToken = token
}
private func createRequest(for endpoint: String, method: HTTPMethod = .GET) -> URLRequest? {
guard let url = URL(string: baseURL + endpoint) else { return nil }
var request = URLRequest(url: url)
request.httpMethod = method.rawValue
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
if let token = jwtToken {
request.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization")
}
return request
}
}
enum HTTPMethod: String {
case GET = "GET"
case POST = "POST"
case PUT = "PUT"
case DELETE = "DELETE"
}
extension RentManagerAPI {
func fetchProperties(completion: @escaping (Result<[Property], Error>) -> Void) {
guard let request = createRequest(for: "/properties") else {
completion(.failure(APIError.invalidURL))
return
}
URLSession.shared.dataTask(with: request) { data, response, error in
if let error = error {
completion(.failure(error))
return
}
guard let data = data else {
completion(.failure(APIError.noData))
return
}
do {
let properties = try JSONDecoder().decode([Property].self, from: data)
DispatchQueue.main.async {
completion(.success(properties))
}
} catch {
completion(.failure(error))
}
}.resume()
}
}
struct Property: Codable {
let id: Int
let type: String?
let country: String
let address: String
let bedrooms: Int?
let bathrooms: Int?
let area: Double?
let rentPrice: Double?
let isAvailable: Bool
}
import SwiftUI
struct PropertiesView: View {
@StateObject private var viewModel = PropertiesViewModel()
var body: some View {
NavigationView {
List(viewModel.properties) { property in
PropertyRowView(property: property)
}
.navigationTitle("Properties")
.onAppear {
viewModel.loadProperties()
}
.refreshable {
viewModel.loadProperties()
}
}
}
}
class PropertiesViewModel: ObservableObject {
@Published var properties: [Property] = []
@Published var isLoading = false
func loadProperties() {
isLoading = true
RentManagerAPI.shared.fetchProperties { [weak self] result in
self?.isLoading = false
switch result {
case .success(let properties):
self?.properties = properties
case .failure(let error):
print("Error loading properties: \(error)")
}
}
}
}
Internal documentation and resources for our iOS development team