DarkRoom: Elegant Media Viewer Written In Swift

DarkRoom

Elegant Media Viewer Written In Swift.

Features

  • Presenting/Dismissing Images And Videos With Showy Animations.
  • Play Video With Custom Control Configuration.
  • Support Custom Configuration For Almost Each Component.
  • Support HLS And Local Videos.
  • Documented By DocC.
  • Support AVAssetResourceLoaderDelegate.
  • Support CocoaPods(soon)
  • Support Carthage

Requirements

Platform Minimum Swift Version Minimum Swift Tools Version Installation Status
iOS 13.0+ 5.0 5.5 SPM Tested

Installation

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler.

Once you have your Swift package set up, adding DarkRoom as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(url: "https://github.com/divar-ir/DarkRoom.git", .upToNextMajor(from: "1.0.0"))
]

Sample

We have provided one sample project in the repository. To use it clone the repo, Source files for these are in the iOS-Example directory in project navigator. Have fun!

Usage

The Main Component is DarkRoomCarouselViewController which you can use and provide it with datasource to show images or play videos.

Do not forget to create your own strategy of loading images by implementing DarkRoomImageLoader and passing it to DarkRoomCarouselViewController initializer.

In case you are using CollectionView to open DarkRoomCarouselViewController and the datasource is shared, consider providing initialIndex, or the datasource will request for wrong data and causes undefined behaviors.

let carouselController = DarkRoomCarouselViewController(
    imageDataSource: self,
    imageDelegate: self,
    imageLoader: ImageLoaderImpl(),
    initialIndex: 0,
    configuration: DarkRoomCarouselDefaultConfiguration()
)

self.present(carouselController, animated: true)

Inspiration

The first version of this library was inspired by ImageViewer.Swift

Contributors

Feel free to share your ideas or any other problems. Pull requests are welcomed.

License

DarkRoom was released under an MIT license. See LICENSE for more information.

GitHub

View Github