Руководство по-русски
Travelpayouts Travel App iOS is an app template for flights and hotels search. When your user books flight or hotel, you get paid. Aviasales, Jetradar and Hotellook official apps are based on the same code.
You can use this template as a base for you application, or you can use it as is changing only the main settings (app title, color scheme, icon, etc).
To track statistics and payments, please visit our affiliate network website — Travelpayouts.com.
To learn more about the Travelpayouts affiliate network, please visit Travelpayouts FAQ.
- Xcode 14.2 (14C18)
- Download the latest release of template project (not beta) here: https://github.com/travelpayouts/travel-app-ios/releases, file Source Code (zip). Alternatively you can clone the repository for development.
- Dependencies are managed via CocoaPods (cocoapods.org). It can be installed via Bundler. The following installation commands should be executed in the project folder (unpacked zip archive or cloned repository):
sudo gem install bundler
bundle install
bundle exec pod install --repo-update
Use the TravelpayoutsTravelApp.xcworkspace
to work with your project.
- Add your partner's token and marker in
TravelpayoutsTravelApp/default_config.plist
file to parameterspartner_marker
andapi_token
. You can get the partner marker and API token on our website: Travelpayouts. - AppStore app publishing requires unique app identifier (bundle id). It can be configured in Xcode.
- Change app name in files
Info.plist
andLaunchScreen.xib
. - Use the
default_config.plist
config file to enable/disable flights/hotels tabs, to add app description, feedback email, app website link and App Store app link for the "About" page and to add localized values for external links. - Test the app on your iPhone/iPad or in Xcode simulator.
- Publish the app via App Store Connect
Application supports iOS 13.0 and higher
Do not forget to replace app icons (Template project includes simple white icons by default). To do this you will need to replace icons in TravelpayoutsTravelApp/AppIcon.xcassets/AppIcon.appiconset
folder (20.png, 29.png, 40.png etc) with your own icons with same names.
- If you want to remove flights or hotels search tab, change values of
flights_enabled
andhotels_enabled
to NO in Project settings. Information tab can't be removed this way. - You can add Car Rental tab. To do this you need to join one car rental affiliate program from Travelpayouts programs. Then you will need to generate an affiliate link and add it to the
TravelpayoutsTravelApp/default_config.plist
file to parametercar_rental_link
. Note: Don't use Economybookings, because this program can't track a mobile traffic.
You can choose color scheme in default_config.plist
file.
Here is a list of color scheme settings with explanations:
Title | Description |
---|---|
main_color | Primary app color |
action_color | Actions highlight color |
Fine-grained color customization can be configured in file ASTJRC.swift
by overriding colors from the base class JRC
.
You can change search forms titles in AppLocalizations.swift
file. Uncomment and edit a variable to change corresponding search form title. Title can be localized in multiple languages if you use NSLocalizedString
and add all localizations to Localizable.strings
files.
To get additional profit from ads, we've integrated Mobile Ads Appodeal SDK in the app. To configure it, specify the appodeal_key
parameter in the default_config.plist
file (get your API key by registering at Appodeal). Ads will appear on the waiting screens for tickets and hotels searching by default.
Don't forget to enable all ad modules for Appodeal. To do this edit the Podfile
file, uncomment the pod 'APD...
lines and execute bundle exec pod install
in the terminal.
Set up the feedback_email
and itunes_link
parameters in default_config.plist
file to activate "Contact us" and "Rate this app" links.
The recommended format for itunes_link
is the following: https://itunes.apple.com/app/id1234567890?action=write-review
, where id1234567890
is the identifier of a published application.
Template app supports Firebase services. To enable them, please connect your app in the Firebase console, download and copy with replacement the GoogleService-Info.plist
file to TravelpayoutsTravelApp
folder and switch the firebase_enabled
flag to YES
in the default_config.plist
file. Out of the box there is an analytics support for: Search / Ticket opened / Ticket booked in the airlines part and Search / Hotel opened / Hotel booked in the hotels part of the app.
Travelpayouts Sample Flights App is an example of an existing iPhone/iPad app integration with AviasalesKit library to add flights/hotels/car rental search. Users of your app will be able to book tickets or hotels and you will get paid.
To track statistics and payments, please visit our affiliate network website — Travelpayouts.com.
To learn more about the Travelpayouts affiliate network, please visit Travelpayouts FAQ.
App should support iOS 13.0 or newer as the minimum iOS version, and it should support Swift language. If your app is written in Objective-C you can wrap all library calls in a class which will be available in Objective-C.
Add the following function with dependencies to Podfile
def aviasales_kit_dependencies
pod 'AviasalesKit', podspec: 'https://ios.aviasales.ru/cocoapods/AviasalesKit_6.7.podspec'
# forked AviasalesKit dependencies
pod 'EasyTipView', git: 'https://github.com/KosyanMedia/EasyTipView.git', commit: 'ab95be17ce90ff163569e50e2e2b659f003d80a4'
pod "CollectionSwipableCellExtension", git: 'https://github.com/KosyanMedia/CollectionSwipableCellExtension.git', commit: 'd3d7c9ee8721562174cbd2c89f88b1d05bbc5fc0'
pod 'Neon', git: 'https://github.com/KosyanMedia/Neon.git', commit: '3770df30ee072a728becb8f1f6b7c29276a3dab4'
end
In the target from which you want to launch the search screens call the dependencies function.
target 'SampleFlightsApp' do
aviasales_kit_dependencies
end
Install dependencies.
pod install --repo-update
Add initialization code to your AppDelegate. Alternatively you can call this setup once before the first AviasalesViewControllersFactory invocation.
import ASTemplateConfiguration
AviasalesViewControllersFactory.shared.setup(window: window, config: { () -> Config in
var colorParams = ColorParams()
colorParams.mainColor = "9C6CBE" // primary style color (search form background)
colorParams.actionColor = "CE0755" // secondary style color (search button)
var config = Config()
config.partnerMarker = "YOUR MARKER" // partner marker https://travelpayouts.com/
config.apiToken = "YOUR TOKEN" // partner token https://travelpayouts.com/
config.carRentalLink = "RENTAL PARTNER LINK" // (optional) partner link to car rental https://www.travelpayouts.com/programs
config.colorParams = colorParams
return config
}())
Create required screens where you need them:
let flightsViewController = AviasalesViewControllersFactory.shared.flightsViewController()
let hotelsViewController = AviasalesViewControllersFactory.shared.hotelsViewController()
let carRentalViewController = AviasalesViewControllersFactory.shared.carRentalViewController()
viewController.present(flightsViewController, animated: true, completion: nil)
The library requires some changes in info.plist to work correctly:
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Used to find nearby hotels.</string>
NSAppTransportSecurity changes are required for some booking agencies. NSLocationWhenInUseUsageDescription is required for nearest hotels search function.
You can configure some of the same settings as in the Travel App.
Colors can be configured the same way as in ASTJRC.swift
.
Search screen titles and some other texts can be configured the same way as in AppLocalizations.swift
.