SmartTravel is an iOS app (Swift 5 / SwiftUI 3) that lets travellers:
- create accounts & sign in
- generate AI‑powered itineraries with Google Gemini
- browse a catalogue of 5 curated “Discover” trips and add them to My Trips
- store trips per‑user in Core Data (each account sees only its own)
- view rich place details (rating, address, map pin) via Google Places + MapKit
| Category | Details |
|---|---|
| Authentication | Local Core Data User table; login / register / change‑password; text‑fields reset on logout. |
| Trip Wizard | Destination → Travellers → Budget → Dates → Review → AI build → Loading animation → Itinerary result. |
| AI Generation | GeminiService calls Google Gemini 2.0 (Pro/Flash) and maps clean JSON into DayPlan models. |
| Discover | 5 hand‑picked itineraries (1‑4 days) you can preview & add to My Trips. |
| Per‑User Storage | Each Trip is tagged with the creating user’s UUID; MyTripsView filters automatically. |
| Map Details | Google Places “FindPlaceFromText” → rating, address, pin overlay in ActivityDetailView. |
| Offline‑first | Core Data persistence with lightweight migration. |
| Modern UI | 100 % SwiftUI, dark‑mode‑ready, SF Symbols, gradient titles, custom calendar grid. |
SmartTravel follows MVVM:
View ──► binds──► ViewModel ──► Model layer (Core Data / Services)
- ViewModels –
AuthViewModel,TripViewModel,DestinationSearchViewModel,OnboardingViewModel - Services –
GeminiService(AI),PlaceDetailViewModel(Google Places) - Models –
User,Trip,DayPlan,Event+ enums (BudgetRange,TravelParty) - Persistence –
PersistenceControllerwrapsNSPersistentContainer
| Area | Library / API |
|---|---|
| Language | Swift 5.10 |
| UI | SwiftUI 3, SF Symbols, MapKit |
| Storage | Core Data |
| AI | Google Generative AI – gemini‑2.0‑pro / flash |
| Places | Google Places REST API (FindPlaceFromText) |
| Build | Xcode 15+ |
| Minimum OS | iOS 17.0 (tested on iOS 18 simulator) |
git clone https://github.com/amitabhsinghh/SmartTravel.git
cd SmartTravelopen SmartTravel.xcodeprojCreate a file called Secrets.xcconfig (already git‑ignored) and add:
GEMINI_KEY = <your-gemini-api-key>
PLACES_KEY = <your-google-places-key>
Then in Build Settings ▸ Swift Compiler – Custom Flags, add:
-DGEMINI_KEY="$(GEMINI_KEY)"
-DPLACES_KEY="$(PLACES_KEY)"
⚠️ You can also hard‑code the keys inGeminiService.swiftandGooglePlaceSearchResult.swift(less secure, not recommended).
Select an iPhone simulator (e.g. iPhone 15 Pro) and press ▶︎ Run.
- User signs in →
AuthViewModelstores aUserentity and togglesisLoggedIn. Wizard(insideHomeView) collects destination, travellers, budget, dates.ReviewTripViewcallsTripViewModel.generate()which invokesGeminiBuilder.build().GeminiServicereturns raw JSON → decoded into[DayPlan]→ held inTripViewModel.LoadingViewanimates until generation finishes, then pushesItineraryResultsView.- Save writes a
TripwithuserId == currentUser.id;MyTripsViewfilters by that ID. DiscoverViewshows static itineraries; tapping Add duplicates them into Core Data.ActivityDetailViewfetches Google Places info and renders a MapKit preview.
SmartTravel/
├── CoreData/ # .xcdatamodeld schema
├── Models/ # value types & NSManagedObject subclasses
├── ViewModels/ # business logic
├── Views/ # SwiftUI screens & components
├── Services/ # network / AI helpers
├── Resources/ # Assets.xcassets, LaunchScreen.storyboardMIT License © Amitabh Singh ✅