Skip to content

Elegant Media Viewer Written In Swift, Support Loading Videos And Images Locally And Remotely.

License

Notifications You must be signed in to change notification settings

divar-ir/DarkRoom

Repository files navigation

DarkRoom

Swift Platforms Swift Package Manager

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 Link To Documentation.
  • Support CocoaPods and SPM.
  • Support AVAssetResourceLoaderDelegate.

Requirements

Platform Minimum Swift Version Minimum Swift Tools Version Installation Status
iOS 13.0+ 5.0 5.5 SPM Tested
iOS 13.0+ 5.0 5.5 CocoaPods 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"))
]

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate DarkRoom into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'DarkRoom'

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!

ex ex

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.