Step-by-Step Tutorials

Implementation tutorials for our rental management iOS application

Getting Started

Development environment setup and iOS app configuration for our RentManager API integration.

  • • Xcode setup
  • • Apple Developer account
  • • Project configuration
  • • First API call
Start Tutorial

Authentication Flow

Implementation guide for our Apple Sign-In authentication with JWT token management.

  • • Apple Sign-In setup
  • • Token storage
  • • Auto-refresh
  • • Error handling
Start Tutorial

Property CRUD

Build complete property management features with SwiftUI.

  • • List properties
  • • Create new properties
  • • Edit & update
  • • Delete properties
Start Tutorial

Advanced Features

Implement advanced features like offline support and push notifications.

  • • Core Data integration
  • • Push notifications
  • • Background sync
  • • Offline mode
Start Tutorial

Testing & Debugging

Learn testing strategies and debugging techniques for your rental app.

  • • Unit tests
  • • UI tests
  • • Network mocking
  • • Debug tools
Start Tutorial

App Store Deployment

Prepare and deploy your rental management app to the App Store.

  • • App Store guidelines
  • • Screenshots & metadata
  • • TestFlight beta
  • • Release process
Start Tutorial

Getting Started

Development environment setup guide and iOS app configuration for our RentManager API integration.

Prerequisites

  • • macOS with Xcode 14.0 or later
  • • Active Apple Developer account
  • • Basic Swift programming knowledge
  • • RentManager API access credentials

Step 1: Create New iOS Project

  1. Open Xcode and select "Create a new Xcode project"
  2. Choose "iOS" → "App" template
  3. Enter project details:
    • Product Name: "RentManager"
    • Interface: SwiftUI
    • Language: Swift
    • Bundle Identifier: com.yourcompany.rentmanager
  4. Choose a location and create the project

Step 2: Configure Capabilities

  1. Select your project in the navigator
  2. Go to "Signing & Capabilities" tab
  3. Add "Sign In with Apple" capability
  4. Ensure your team and bundle identifier are correct

Step 3: Add Required Dependencies

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")
]

Step 4: Create Your First API Call

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")
        }
    }
}

🎉 Congratulations!

You've successfully set up your iOS project. Next, move on to the Authentication Flow tutorial to implement Apple Sign-In.

Authentication Flow

Implementation guide for our secure Apple Sign-In authentication with automatic token management and refresh capabilities.

Step 1: Create Authentication Manager

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)")
            }
        }
    }
}

Step 2: Handle Apple Sign-In Response

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
    }
}

Step 3: Create Login View

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()
    }
}

🔐 Security Note

Always validate identity tokens on your backend server. Never trust client-side validation alone for authentication decisions.