Skip to content

Commit

Permalink
InitialRelease
Browse files Browse the repository at this point in the history
* updated README

* updated README

* updated README

* updated readme and docc

* fix image path

* fix image path

* fix readme

* fix readme

* fix gitignore

* added license to each file

* updated requirement

* fix badge on readme

* fix badge on readme

* fix name on readme

* enhanced readme
  • Loading branch information
kiarashvosough1999 authored Sep 11, 2022
1 parent 0748ca8 commit db1d90b
Show file tree
Hide file tree
Showing 92 changed files with 1,653 additions and 116 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ xcuserdata

### SwiftPM ###

.swiftpm/


### Xcode ###

Expand Down
7 changes: 2 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.4
// swift-tools-version:5.5
import PackageDescription

let package = Package(
Expand All @@ -16,10 +16,7 @@ let package = Package(
.target(
name: "DarkRoom",
dependencies: [],
path: "Sources",
linkerSettings: [
.linkedFramework("UIKit")
]
path: "Sources"
)
]
)
30 changes: 19 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@

<p align="center">
<img src="https://github.com/divar-ir/DarkRoom/blob/pre-release-issues/Sources/DarkRoom/DarkRoom.docc/Resources/DarkRoomLogo.png">
</p>

# DarkRoom

[![Swift](https://img.shields.io/badge/Swift-5.6_or_Higher-orange?style=flat-square)](https://img.shields.io/badge/Swift-5.6-Orange?style=flat-square)
[![Swift](https://img.shields.io/badge/Swift-5.0_or_Higher-orange?style=flat-square)](https://img.shields.io/badge/Swift-5.0-Orange?style=flat-square)
[![Platforms](https://img.shields.io/badge/Platforms-iOS_13_or_Higher-yellowgreen?style=flat-square)](https://img.shields.io/badge/Platforms-macOS_iOS_tvOS_watchOS_Linux_Windows-Green?style=flat-square)
[![Swift Package Manager](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square)](https://img.shields.io/badge/Swift_Package_Manager-compatible-orange?style=flat-square)

Elegant Media Viewer Written In Swift.

Expand All @@ -15,19 +21,21 @@ Elegant Media Viewer Written In Swift.

## Features

- [x] View Image With Showy Animations.
- [x] Play Video With Custom Control, etc.
- [x] Presenting/Dismissing Images And Videos With Showy Animations.
- [x] Play Video With Custom Control Configuration.
- [x] Support Custom Configuration For Almost Each Component.
- [x] Support HLS And Local Videos.
- [x] Documented By DocC.
- [ ] Support UserDefined `AVAssetResourceLoaderDelegate`.
- [ ] Support `AVAssetResourceLoaderDelegate`.
- [ ] Support `CocoaPods`(soon)
- [ ] Support `Carthage`


## Requirements

| Platform | Minimum Swift Version | Installation | Status |
| --- | --- | --- | --- |
| iOS 13.0+ | 5.6 | [SPM](#SwiftPackageManager) | Tested |
| Platform | Minimum Swift Version | Minimum Swift Tools Version | Installation | Status |
| --- | --- | --- | --- | --- |
| iOS 13.0+ | 5.0 | 5.5 | [SPM](#SwiftPackageManager) | Tested |

## Installation

Expand All @@ -43,17 +51,17 @@ dependencies: [
]
```

## sample
## 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 ``DarkRoomCarousel`` which you can use and provide it with datasource to show images or play videos.
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 ``DarkRoomCarousel`` initializer.
> 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 ``DarkRoomCarousel``, consider providing `initialIndex`, or the datasource will request for wrong data and casuses undefined behaviors.
> 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.
```swift
let carouselController = DarkRoomCarouselViewController(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@
//
// Created by Kiarash Vosough on 8/2/22.
//
// Copyright (c) 2022 Divar
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

import UIKit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@
//
// Created by Kiarash Vosough on 8/2/22.
//
// Copyright (c) 2022 Divar
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

import UIKit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@
//
// Created by Kiarash Vosough on 8/2/22.
//
// Copyright (c) 2022 Divar
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

import UIKit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@
//
// Created by Kiarash Vosough on 8/2/22.
//
// Copyright (c) 2022 Divar
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

import UIKit

Expand Down
19 changes: 19 additions & 0 deletions Sources/DarkRoom/Carousel/DarkRoomCarouselDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@
//
// Created by Kiarash Vosough on 7/31/22.
//
// Copyright (c) 2022 Divar
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

import UIKit

Expand Down
26 changes: 22 additions & 4 deletions Sources/DarkRoom/Carousel/DarkRoomCarouselDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,25 @@
//
// Created by Karo Sahafi on 11/15/21.
//

// Copyright (c) 2022 Divar
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
import UIKit

/// Delegate for ``DarkRoomCarouselViewController``
Expand All @@ -14,10 +32,10 @@ public protocol DarkRoomCarouselDelegate: AnyObject {
/// - Parameter index: The index of page which is on the screen
func carousel(didSlideToIndex index: Int)

/// Notify whenever the ``DarkRoomCarouselViewController``'s ``UIBarButtonItem`` is tapped
/// Notify whenever the ``DarkRoomCarouselViewController``'s `UIBarButtonItem` is tapped
/// - Parameters:
/// - item: The ``UIBarButtonItem`` which was tapped
/// - index: Index of the page which contains the ``UIBarButtonItem``
/// - item: The `UIBarButtonItem` which was tapped
/// - index: Index of the page which contains the `UIBarButtonItem`
func carousel(didTapedBarButtonItem item: UIBarButtonItem, index: Int)
}

Expand Down
27 changes: 23 additions & 4 deletions Sources/DarkRoom/Carousel/DarkRoomCarouselOption.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,38 @@
// DarkRoomMediaController.swift
//
//
// Created by Kiarash Vosough on 7/9/22.
// Created by Kiarash Vosough on 7/31/22.
//
// Copyright (c) 2022 Divar
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

import UIKit

public enum DarkRoomCarouselOption {

/// Set the icon to `leftBarButtonItem` of ``UINavigationItem`` which belongs to ``DarkRoomCarouselViewController``
/// Set the icon to `leftBarButtonItem` of `UINavigationItem` which belongs to ``DarkRoomCarouselViewController``
case closeIcon(icon: UIImage)

/// Set title on new ``UIBarButtonItem`` and insert it on ``UINavigationItem`` which belongs to ``DarkRoomCarouselViewController``
/// Set title on new `UIBarButtonItem` and insert it on `UINavigationItem` which belongs to ``DarkRoomCarouselViewController``
case rightNavItemTitle(title: String)

/// Set icon on new ``UIBarButtonItem`` and insert it on ``UINavigationItem`` which belongs to ``DarkRoomCarouselViewController``
/// Set icon on new `UIBarButtonItem` and insert it on `UINavigationItem` which belongs to ``DarkRoomCarouselViewController``
case rightNavItemIcon(icon: UIImage)
}
19 changes: 19 additions & 0 deletions Sources/DarkRoom/Carousel/DarkRoomCarouselViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@
//
// Created by Karo Sahafi on 11/15/21.
//
// Copyright (c) 2022 Divar
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

import UIKit

Expand Down
19 changes: 19 additions & 0 deletions Sources/DarkRoom/Configuraion/DarkRoomCarouselConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@
//
// Created by Kiarash Vosough on 8/2/22.
//
// Copyright (c) 2022 Divar
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

import UIKit

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@
//
// Created by Kiarash Vosough on 8/2/22.
//
// Copyright (c) 2022 Divar
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

import UIKit

Expand Down
Loading

0 comments on commit db1d90b

Please sign in to comment.