Skip to content

This example demonsrates 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.

License

PerfectExamples/ImageLibraryDemo

Repository files navigation

Perfect Image Library Demo 简体中文

Get Involed with Perfect!

Star Perfect On Github Stack Overflow Follow Perfect on Twitter Join the Perfect Slack

Swift 4.0 Platforms OS X | Linux License Apache PerfectlySoft Twitter Slack Status

Perfect Image Library Demo Project

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

Compatibility with Swift

The master branch of this project currently compiles with Xcode 9.2 or the Swift 4.0.3 toolchain.

Building & Running

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.

Running the Web App

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.

Running the iOS App

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.

Further Information

For more information on the Perfect project, please visit perfect.org.

About

This example demonsrates 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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published