Implementation tutorials for our rental management iOS application
Development environment setup and iOS app configuration for our RentManager API integration.
Implementation guide for our Apple Sign-In authentication with JWT token management.
Build complete property management features with SwiftUI.
Implement advanced features like offline support and push notifications.
Learn testing strategies and debugging techniques for your rental app.
Prepare and deploy your rental management app to the App Store.
Development environment setup guide and iOS app configuration for our RentManager API integration.
Add the following to your project dependencies:
// In Package.swift or via Xcode Package Manager
dependencies: [
.package(url: "https://github.com/Alamofire/Alamofire.git", from: "5.8.0")
]
Create a simple API service to test connectivity:
import Foundation
class APIService {
static let shared = APIService()
private let baseURL = "https://rentmanager.io/api"
private init() {}
func testConnection() async throws {
guard let url = URL(string: baseURL + "/health") else {
throw URLError(.badURL)
}
let (_, response) = try await URLSession.shared.data(from: url)
if let httpResponse = response as? HTTPURLResponse,
httpResponse.statusCode == 200 {
print("✅ API connection successful!")
} else {
print("❌ API connection failed")
}
}
}
You've successfully set up your iOS project. Next, move on to the Authentication Flow tutorial to implement Apple Sign-In.
Implementation guide for our secure Apple Sign-In authentication with automatic token management and refresh capabilities.
import AuthenticationServices
import Foundation
@MainActor
class AuthenticationManager: ObservableObject {
@Published var isAuthenticated = false
@Published var currentUser: User?
@Published var isLoading = false
private let api = RentManagerAPI.shared
init() {
checkAuthenticationStatus()
}
private func checkAuthenticationStatus() {
isAuthenticated = TokenManager.shared.getAccessToken() != nil
if isAuthenticated {
loadCurrentUser()
}
}
func signInWithApple() {
let request = ASAuthorizationAppleIDProvider().createRequest()
request.requestedScopes = [.fullName, .email]
let authController = ASAuthorizationController(authorizationRequests: [request])
authController.delegate = self
authController.presentationContextProvider = self
authController.performRequests()
}
func signOut() async {
isLoading = true
do {
try await api.logout()
} catch {
print("Logout error: \(error)")
}
TokenManager.shared.clearTokens()
isAuthenticated = false
currentUser = nil
isLoading = false
}
private func loadCurrentUser() {
Task {
do {
// Implement user profile fetch
// currentUser = try await api.fetchUserProfile()
} catch {
print("Failed to load user: \(error)")
}
}
}
}
extension AuthenticationManager: ASAuthorizationControllerDelegate {
func authorizationController(
controller: ASAuthorizationController,
didCompleteWithAuthorization authorization: ASAuthorization
) {
guard let credential = authorization.credential as? ASAuthorizationAppleIDCredential,
let identityToken = credential.identityToken,
let tokenString = String(data: identityToken, encoding: .utf8) else {
return
}
isLoading = true
Task {
do {
var userData: [String: Any] = [:]
if let fullName = credential.fullName {
userData["name"] = [
"firstName": fullName.givenName ?? "",
"lastName": fullName.familyName ?? ""
]
}
let response = try await api.authenticateWithApple(
identityToken: tokenString,
user: userData
)
self.isAuthenticated = true
self.currentUser = response.user
} catch {
print("Authentication failed: \(error)")
}
self.isLoading = false
}
}
func authorizationController(
controller: ASAuthorizationController,
didCompleteWithError error: Error
) {
print("Apple Sign-In failed: \(error)")
isLoading = false
}
}
import SwiftUI
import AuthenticationServices
struct LoginView: View {
@ObservedObject var authManager: AuthenticationManager
var body: some View {
VStack(spacing: 32) {
VStack(spacing: 16) {
Image(systemName: "house.circle")
.font(.system(size: 80))
.foregroundColor(.blue)
Text("RentManager")
.font(.largeTitle)
.fontWeight(.bold)
Text("Manage your rental properties with ease")
.font(.body)
.foregroundColor(.secondary)
.multilineTextAlignment(.center)
}
if authManager.isLoading {
ProgressView()
.scaleEffect(1.2)
} else {
SignInWithAppleButton(
onRequest: { _ in },
onCompletion: { _ in
authManager.signInWithApple()
}
)
.signInWithAppleButtonStyle(.black)
.frame(height: 50)
.padding(.horizontal, 40)
}
}
.padding()
}
}
Always validate identity tokens on your backend server. Never trust client-side validation alone for authentication decisions.