The Swift App Sample with Laravel RESTful API.
- Laravel Project for RESTful API (6.5.1 released) - [ApiServer]
- The iOS Project using API (Swift 5.0) - [TestApi]
- MacOS Mojave 10.14.3 or above
- Git
- Apache2, PHP 7.2 or above, MySQL or MariaDB
- Composer
- Xcode 11.0 or above To test the app on physical device, You'll need an Apple Developer Account
- CocoaPods
Clone the repository in your pc using git.
$ git clone https://github.com/superdev115/Laravel-Swift-Sample.git
$ cd Laravel-Swift-Sample
- Install the application's dependencies with Composer
$ cd ApiServer $ composer install
- Create a new database for project. (MySQL).
You can use Terminal like this
or you can use phpMyAdmin.
mysql -u root -p mysql> CREATE DATABASE <your_database_name>;
- Copy the sample configuration file and edit it to match your configuration.
You'll need to set
$ cp .env.example .env
DB_HOST
,DB_DATABASE
,DB_USERNAME
, andDB_PASSWORD
. - Run the application by using Artisan commands.
Clear cache
Generate the
$ php artisan cache:clear
APP_KEY
Run the migrations$ php artisan key:generate
Seed fake data$ php artisan migrate
Run the application using Artisan$ php php artisan db:seed
$ php artisan serve
Install pods using cocoapods.
$ cd TestApi
$ pod install
Open TestApi.xcworkspace file.
The swift project has some pods.
Pod name | Reference |
---|---|
Alamofire | https://github.com/Alamofire/Alamofire |
SwiftyJSON | https://github.com/SwiftyJSON/SwiftyJSON |
Kingfisher | https://github.com/onevcat/Kingfisher |
SQLite.swift | https://github.com/stephencelis/SQLite.swift |
SwiftEventBus | https://github.com/cesarferreira/SwiftEventBus |
MaterialComponents/Snackbar | https://material.io/develop/ios/components/snackbars |
MIT
Free Source Code, Hell Yeah!