Perfect Image Library Demo 简体中文
This example demonstrates the use of a simple API backend to deliver an image gallery listing to a ReactJS web front end, as well as an iOS application.
The ReactJS application is served directly from the executable on port 8181, and the iOS application is meant to be running in the simulator as it is also set to use http://localhost:8181 as the host address for the API.
The iOS application uses ImageSlideshow as it's slideshow mechanism, and the app itself is based on the example from that project.
The Web frontend in ReactJS is built using https://www.npmjs.com/package/react-image-gallery.
Both these applications are using the same API endpoint: http://localhost:8181/api/v1/image
The master branch of this project currently compiles with Xcode 9.2 or the Swift 4.0.3 toolchain.
The following will clone and build an empty starter project and launch the server on port 8181.
git clone https://github.com/PerfectExamples/ImageLibraryDemo.git
cd ImageLibraryDemo/ServerSide
swift build
.build/debug/ImageLibrary
You should see the following output:
[INFO] Running setup: imagefile
[INFO] Starting HTTP server localhost on 0.0.0.0:8181
This means the server is running and waiting for connections. Access http://localhost:8181/ to see the greeting. Hit control-c to terminate the server.
With the server running as above, all that needs to happen to launch the web app is to visit http://localhost:8181 in a browser.
The source for this is in the /ReactClient directory of the project and is a relatively standard ReactJS project.
The iOS app is located in the /iOSApp directory of the project. From the Terminal app, run pod install
within that directory to install the required CocoaPods. Then you should be able to launch the ImageSlideshow.xcworkspace
file, and build & run as normal in a simulator.
For more information on the Perfect project, please visit perfect.org.