An iOS app for managing apartment viewing routes with optimized navigation using the Traveling Salesman Problem (TSP) algorithm.
- 🗺️ Interactive Map View: View all apartments on a map with route visualization
- 📍 Current Location Support: Automatic location tracking and distance calculations
- 🏢 Apartment Management: Add, edit, and delete apartment listings
- 🔍 Address Autocomplete: Quick address entry with MapKit search integration
- 🚗 Route Optimization: TSP algorithm implementation for shortest route calculation
- 💾 Core Data Persistence: Save apartments and routes locally
- 📱 SwiftUI Interface: Modern, responsive UI design
- 🎯 MVVM Architecture: Clean separation of concerns
- Language: Swift 5.0
- UI Framework: SwiftUI
- Minimum iOS: 17.0
- Architecture: MVVM
- Persistence: Core Data
- Maps: MapKit
- Location: CoreLocation
Apartment: Represents an apartment location with coordinates and metadataRoute: Manages waypoints and route optimization stateWaypoint: Individual stops on a route with timing information
LocationService: Handles location permissions and real-time updatesRouteOptimizationService: Implements TSP algorithm with 2-opt improvementCoreDataService: Manages local data persistence
MapView: Interactive map with apartment pins and route displayApartmentListView: Searchable list of apartments with distance sortingRouteDetailView: Detailed route information with reordering capability
The app uses a Nearest Neighbor heuristic with 2-opt improvement for route optimization:
- Nearest Neighbor: Starts from current location and visits the nearest unvisited apartment
- 2-Opt Improvement: Iteratively improves the route by eliminating crossing paths
- MapKit Integration: Calculates actual driving distances and times
- Open
ApartmentRouteMapper.xcodeprojin Xcode - Build and run on iOS 17.0+ device or simulator
- Allow location permissions when prompted
- Add Apartments: Tap + in the Apartments tab to add new locations
- Select Apartments: On the map, tap apartment pins to add them to your route
- Optimize Route: Tap "Optimize Route" to calculate the shortest path
- View Details: Access detailed route information and driving directions
- Save Routes: Save optimized routes for future reference
The project includes comprehensive unit tests for the route optimization algorithm. Run tests with ⌘+U in Xcode.