Are you working remotely and forgetting to step outside and enjoy the nature around you? Or are you frequently searching online for the best places to visit while planning your next getaway? The Traveler application can help! With just a few clicks, Traveler will assist you in finding up to 50 top landmarks and outdoor destinations anywhere in the world.
Quick Note: It is recommended to view this repository in light mode for better readability.
Traveler is powered by Foursquare's Places API to search exclusively for landmarks and outdoor destinations. Using iOS frameworks Core Location and Map Kit, this application allows users to quickly find nearby destinations and view their location on a map. This application is built using Swift
and UIKit
.
To run this project, you will need to add the following environment variables to your Info.plist
file:
API_KEY
: Add Foursquare's Place's API Authentication API Key to your environment. Create a developer account with Foursquare to receive your API Key.
By allowing access to the device's location, the user will be able to find the closest destination on the landing screen without making any searches. The user can also see the category, address, and distance in miles, as well as directions to the destination.
Users can search by typing into the search bar or by clicking on the "Use current location" button. The user can also click on recent searches to quickly repeat a search. The search bar also includes an auto completer to assist the user.
Users can view the results of their search on the result screen and update their search query or apply filters for a better searching experience. The results include a small image, name, and address.
The detail screen includes swipeable oversized images, as well as the category, address, a map view, and a list of related places.
- The main landing screen includes a
scroll view
to display data with large fonts for readability and support for landscape mode. - A guide view (not visible) covers the top half of the device's screen to help position and size the circular image view properly for device orientation.
- An
image view
tap gesture allows the user to go directly to the detail screen with animation to convey that this is a button. - A search
button
in the top navigation clearly communicates the transition to the search screen. - A distance
label
displays the distance in miles to the nearby recommended place. MapKit
is used to show directions to the nearby recommended place.
- The
UISearchBar
is auto-focused as the first responder so the user can start searching as soon as the screen appears. - MKLocalSearchCompleter is configured to show only address results to assist the user in finding the best results.
- The "Use current location" button allows for quick searches of nearby places without typing.
- A recent search
table view
displays a list of search history and allows the user to delete recent searches with a swipe gesture. - The search result label is displayed instead of the result search when displaying a table view list of results from MKLocalSearchCompleter.
- The user can press enter on the device keyboard or tap on a row in the table view to initiate a search.
- As soon as a search is made, the result screen is displayed as a medium detent modal from the search screen, allowing the user to quickly make another search without going back to the previous screen.
- To improve the user experience, the tableView rows are initially displayed with placeholder images and text while the actual data is being loaded.
- The filter section at the top of the modal includes options to filter by "Open Now," set a search limit, and sort the results.
- "Open Now" is a
toggle button
that filters the results to only show destinations that are currently open. - The search limit option is a
dropdown menu button
that allows the user to choose the maximum number of results to display. - The sort option is a
dropdown menu button
that allows the user to sort the results by "Relevance," "Rating" or "Distance." - The results table view displays a list of destinations with an image, name, and address.
- A destination cell tap gesture through delegation pattern allows the user to go directly to the detail screen.
- The detail screen includes swipeable oversized images implemented with
collection view
of the destination, as well as its category, address, and a map view. - A back button in the top left corner allows the user to go back to the previous screen.
- The colors for the application are set using the system coloring, allowing users to view the application in a style that is consistent with their phone's setting. A global variable is used to easily manage and change overall color scheme.
- For more information on the implementation and examples of the application in dark/light mode, see the
ColorPalette
section under Architecture and the Demo section.
- Service
UserService
- Service/manager for user data model containing CRUD methods to manage
User
's properties. - Uses Singleton pattern with a shared property and a private initializer.
- There will only ever be one instance of
User
class needed per application.
- There will only ever be one instance of
- Service/manager for user data model containing CRUD methods to manage
- User
User
- User data model with a set of
RecentSearch
, a set ofLikedLocation
, and aCoordinate
.
- User data model with a set of
RecentSearch
- One-to-many relationship with
User
. - Includes
title
andsubtitle
property and conforms to Codable, Equatable, Hashable protocols to be used as a set byUser
.
- One-to-many relationship with
LikedLocation
- One-to-many relationship with
User
. - Typealias
String
to be used as a set byUser
.
- One-to-many relationship with
- Place
Response
- Decodable data model for response from Places API.
Place
- One-to-many relationship with
Response
. - Decodable data model that defines model for each place.
- One-to-many relationship with
Image
- Decodable data model for Image response from Places API.
- The image URLs will be constructed from this data model as a string and placed inside the
Place
data model'simageUrls
property.- The Places API requires a separate HTTP request for the images data.
imageUrls
inPlace
is not part of the actual response from the API.
- The Places API requires a separate HTTP request for the images data.
- Can be viewed as One-to-many Relationship with
Place
.
- CoreLocation
LocationAnnotation
- Data model for annotations to be placed on the map that conforms to
MKAnnotation
protocol.
- Data model for annotations to be placed on the map that conforms to
Coordindate
- One-to-one relationship with
Place
. - One-to-one relationship with
User
aslastLocation
property.
- One-to-one relationship with
- Cell
SearchCell
- Definesthe UI for Search Screen's tableView row.
- Contains an
update
method is used bySearchViewController
to update the data. - There are two
update
methods: one forRecentSearch
to display recent searches, and another forMKLocalSearchCompletion
to display search completer results.
ResultCell
- Defines the UI for Result Screen's tableView row.
- Contains an
update
method that is used byResultViewController
to update the data.
ImageCell
- Defines the UI for Detail Screen's collectionView row.
- Contains an
Update
method is used by DetailViewController's to update data
- Extensions
UIImageViewExtension
- Extends
UIImageView
with anloadFrom
method that accepts url and a boolean for animation as arguments and loads the image.
- Extends
UIButtonExtension
- Extends
UIButton
withconfigureButton
method that helps with configuring the button easily with one method.
- Extends
UILabelExtension
- Extends
UILabel
withconfigureLabel
method for easy configuration.
- Extends
UITextViewExtension
- Extends
UITextView
withconfigureNonEditableTextView
method for easy configuration.
- Extends
ColorPalette
- Extends
UIColor
with aMyColor
struct with color properties used in the application.
- Extends
HomeViewController
- Subclass of
UIViewController
- Conforms to
MKMapViewDelegate
protocol and acts as a delegate for aMKMapView
object to display a route to the destination from user's location. - Conforms to
CLLocationManagerDelegate
protocol and acts as a delegate forCLLocationManager
object to receive updates about the location of the device. - Each view controller is organized as extensions for maintainability, readability, and scalability.
- Subclass of
SearchViewController
- Subclass of
UIViewController
- Conforms to
UISearchBarDelegate
protocol and acts a delegate for aUISearchBar
object to receive the search query entered into the search bar. - Conforms to
MKLocalSearchCompleterDelegate
protocol and acts as a delegate for aMKLocalSearchCompleter
object that receives completions based on a search query. - Conforms to
UITableViewDelegate
andUITableViewDataSource
protocols and acts as a delegate and datasource for thetableView
to define the data to be displayed and receives events when user clicks on the row.
- Subclass of
ResultViewController
- Subclass of
UIViewController
- Conforms to
UITableViewDelegate
andUITableViewDataSource
protocols.
- Subclass of
DetailViewController
- Subclass of
UIViewController
- Conforms to
UICollectionViewDelegate
andUICollectionViewDataSource
protocols.
- Subclass of
- Utility
HTTPRequest
- A class that contains static methods
buildRequest
andmakeRequest
that are used in the view controllers to build the HTTP request and make the request. - The main use for this class is to avoid repetitive code. (D.R.Y.)
- A class that contains static methods
For better quality video and full demo, please checkout the links below.
- Add support for multiple languages to increase the global appeal of the app.
- Add a feature for users to plan and book activities and experiences, such as tours, hikes, and adventure sports
- Integrate with other travel-related APIs, such as flight and hotel booking
- Allow users to create and save custom travel itineraries
- Add integration with social media platforms, such as Facebook and Instagram, for users to share their travels with friends and followers
- Implement a feature for users to receive personalized recommendations based on their past search and visit history
- Add integration with weather apps, so users can plan their trips around the weather
- Enable related places button to refresh the Detail screen with the selected location
- Add a view for review section
- Add a screen for liked locations and automatically organize them by city
- Add a button to mark places as visited
- Connect with iPhone's Map for user to quickly turn on navigation to selected destination