16 Commits

Author SHA1 Message Date
Visal Rajapakse 0f6ff38a71 Fixed broken preview video
Fixes #11
2021-08-04 11:23:45 +05:30
Visal Rajapakse e072b40ea5 Merge pull request #6 from jabernall24/updating_comments
Update comments with correct default values for glideFactors
2021-06-10 23:56:27 +05:30
Visal Rajapakse de1e60ee6b Merge pull request #8 from jabernall24/magic_number_55
Give some context to 55 for circular slideshows
2021-06-03 11:27:54 +05:30
Visal Rajapakse f469bd70ab Merge pull request #9 from jabernall24/test_glidecell
Adding some tests for GlideCell
2021-06-03 11:26:47 +05:30
Visal Rajapakse 8d19bad3e9 Merge pull request #5 from jabernall24/adding_tests
Adding tests for Glideshow
2021-06-03 11:26:30 +05:30
jabernall24 689f0b1bfb Adding some tests for GlideCell 2021-06-01 11:55:46 -07:00
jabernall24 fcdf49d4a4 Give some context to 55 2021-06-01 11:07:43 -07:00
jabernall24 52b001769e Update comments with correct default values 2021-06-01 10:48:37 -07:00
jabernall24 09aa06bec1 Adding tests for Glideshow 2021-06-01 10:37:59 -07:00
Visal Rajapakse 35c8f76b22 Update README.md 2021-04-06 20:12:28 +05:30
Visal Rajapakse 249fd977e3 Update README.md 2021-03-10 17:16:26 +05:30
Visal Rajapakse f61639a53f Delegate method updates 2021-03-10 15:34:36 +05:30
Visal Rajapakse cebff16524 Podspec update v1.1.1 2021-03-10 09:02:21 +05:30
Visal Rajapakse 03d73775f2 Update README.md 2021-03-10 08:34:12 +05:30
Visal Rajapakse 3a45fcc386 Update README.md 2021-03-10 01:22:00 +05:30
Visal Rajapakse efc710363e Update README.md 2021-03-10 01:06:43 +05:30
11 changed files with 211 additions and 18 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
Pod::Spec.new do |spec|
spec.name = "Glideshow"
spec.version = "1.0.0"
spec.version = "1.1.1"
spec.summary = "A slideshow written in Swift 5 that adds transitions to labels within a slide"
spec.description = <<-DESC
@@ -12,8 +12,8 @@ Pod::Spec.new do |spec|
spec.license = { :type => "MIT", :file => "LICENSE" }
spec.author = { "Visal Rajapakse" => "visalrajapakse@gmail.com" }
spec.platform = :ios, "13.0"
spec.ios.deployment_target = "13.0"
spec.platform = :ios, "11.0"
spec.ios.deployment_target = "11.0"
spec.swift_version = "5"
spec.source = { :git => "https://github.com/v15a1/Glideshow.git", :tag => "#{spec.version}" }
+4
View File
@@ -24,6 +24,7 @@
4B0CF41A25EBD590005975B1 /* GlideCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B0CF41925EBD590005975B1 /* GlideCell.swift */; };
4B3447F525F7CD6D00A713F2 /* ImageCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B3447F425F7CD6D00A713F2 /* ImageCache.swift */; };
4BB22DFB25F7D35800B6FD9D /* ImageLoader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB22DFA25F7D35800B6FD9D /* ImageLoader.swift */; };
6E82188B2666B6450012A2CD /* GlideCellTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6E82188A2666B6450012A2CD /* GlideCellTests.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -78,6 +79,7 @@
4B0CF41925EBD590005975B1 /* GlideCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlideCell.swift; sourceTree = "<group>"; };
4B3447F425F7CD6D00A713F2 /* ImageCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageCache.swift; sourceTree = "<group>"; };
4BB22DFA25F7D35800B6FD9D /* ImageLoader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageLoader.swift; sourceTree = "<group>"; };
6E82188A2666B6450012A2CD /* GlideCellTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlideCellTests.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -148,6 +150,7 @@
children = (
4B0739F425EB56BD003FF9C1 /* GlideshowTests.swift */,
4B0739F625EB56BD003FF9C1 /* Info.plist */,
6E82188A2666B6450012A2CD /* GlideCellTests.swift */,
);
path = GlideshowTests;
sourceTree = "<group>";
@@ -329,6 +332,7 @@
buildActionMask = 2147483647;
files = (
4B0739F525EB56BD003FF9C1 /* GlideshowTests.swift in Sources */,
6E82188B2666B6450012A2CD /* GlideCellTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
+3 -3
View File
@@ -140,7 +140,7 @@ class GlideCell: UICollectionViewCell {
}()
/// Spacing between labels of the slide. Default value : 8
public var labelSpacing : CGFloat!
public var labelSpacing : CGFloat = 8
/// Animateable GlideLabels for gliding
public var animateableViews : [GlideLabel]?
@@ -152,14 +152,14 @@ class GlideCell: UICollectionViewCell {
}
}
/// glide factor for the description lable. Default: 2
/// glide factor for the description lable. Default: 3
public var descriptionGlideFactor : CGFloat = 3 {
didSet{
slideDescription.glideFactor = titleGlideFactor
}
}
/// glide factor for the title lable. Default: 2
/// glide factor for the title lable. Default: 1
public var captionGlideFactor : CGFloat = 1 {
didSet{
slideCaption.glideFactor = titleGlideFactor
+6 -2
View File
@@ -7,6 +7,9 @@
import UIKit
// Magic number used to give the user the feeling they are able to swipe infinitely
fileprivate let kInifiniteSwipingMultiplier = 55
@objc
/// The delegate protocol that notifies slideshow state changes
public protocol GlideshowProtocol : AnyObject {
@@ -463,7 +466,7 @@ public class Glideshow: UIView {
extension Glideshow : UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return (items?.count ?? 0) * (isCircular ? 55 : 1)
return (items?.count ?? 0) * (isCircular ? kInifiniteSwipingMultiplier : 1)
}
public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
@@ -573,6 +576,7 @@ extension Glideshow : UICollectionViewDelegate, UICollectionViewDataSource, UICo
}
public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
delegate?.glideshowDidSelecteRowAt?(indexPath: indexPath, self)
let index = IndexPath(item: ((pageByMidSection) % items!.count), section: 0)
delegate?.glideshowDidSelecteRowAt?(indexPath: index, self)
}
}
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "dish_default_image.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

+12 -1
View File
@@ -34,8 +34,9 @@ class ViewController: UIViewController {
GlideItem(caption : "Hello in Chinese",title : "你好", description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", backgroundImage: #imageLiteral(resourceName: "image7")),
GlideItem(caption : "Hello in Thai",title : "สวัสดี", description: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.Lorem ipsum dolor sit amet, consectetur adipiscing elit.", backgroundImage: #imageLiteral(resourceName: "image9"))
]
glideshow.delegate = self
glideshow.isCircular = true
glideshow.placeHolderImage = #imageLiteral(resourceName: "placeholder")
glideshow.placeHolderImage = #imageLiteral(resourceName: "dish_default_image")
glideshow.gradientColor =
UIColor.black.withAlphaComponent(0.8)
glideshow.captionFont = UIFont.systemFont(ofSize: 16, weight: .light)
@@ -57,3 +58,13 @@ class ViewController: UIViewController {
}
}
extension ViewController : GlideshowProtocol {
func glideshowDidSelecteRowAt(indexPath: IndexPath, _ glideshow: Glideshow) {
print(indexPath)
}
func pageDidChange(_ glideshow: Glideshow, didChangePageTo page: Int) {
print(page)
}
}
+41
View File
@@ -0,0 +1,41 @@
//
// GlideCellTests.swift
// GlideshowTests
//
// Created by Jesus Andres Bernal Lopez on 6/1/21.
//
import XCTest
@testable import Glideshow
class GlideCellTests: XCTestCase {
func test_configureWithBackgroundImage() {
let cell = GlideCell()
let testItem = GlideItem(caption: "a-caption", title: "a-title", description: "a-description", backgroundImage: UIImage.checkmark)
cell.configure(with: testItem, placeholderImage: nil)
XCTAssertEqual(cell.slideCaption.text, testItem.caption)
XCTAssertEqual(cell.slideTitle.text, testItem.title)
XCTAssertEqual(cell.slideDescription.text, testItem.description)
XCTAssertEqual(cell.backgroundImage, testItem.backgroundImage)
}
func test_configureWithImageURL() {
let cell = GlideCell()
let testItem = GlideItem(caption: "a-caption", title: "a-title", description: "a-description", imageURL: "a-url")
let placeholderImage = UIImage.checkmark
cell.configure(with: testItem, placeholderImage: placeholderImage)
XCTAssertEqual(cell.slideCaption.text, testItem.caption)
XCTAssertEqual(cell.slideTitle.text, testItem.title)
XCTAssertEqual(cell.slideDescription.text, testItem.description)
XCTAssertEqual(cell.backgroundImage, placeholderImage)
}
}
+98
View File
@@ -13,4 +13,102 @@ class GlideshowTests: XCTestCase {
override func setUp() {
glideshow = Glideshow()
}
func test_interval() {
XCTAssertEqual(glideshow.interval, 0)
}
func test_slideMargin() {
XCTAssertEqual(glideshow.slideMargin, UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20))
}
func test_slidePadding() {
XCTAssertEqual(glideshow.slidePadding, UIEdgeInsets(top: 20, left: 20, bottom: 20, right: 20))
}
func test_defaultSldeColor() {
XCTAssertEqual(glideshow.defaultSlideColor, .lightGray)
}
func test_placeHolderImage() {
XCTAssertEqual(glideshow.placeHolderImage, nil)
}
func test_labelSpacing() {
XCTAssertEqual(glideshow.labelSpacing, 8)
}
func test_isGradientEnabled() {
XCTAssertEqual(glideshow.isGradientEnabled, false)
}
func test_titleFont() {
XCTAssertEqual(glideshow.titleFont, UIFont.systemFont(ofSize: 20, weight: .black))
}
func test_descriptionGlideFactor() {
XCTAssertEqual(glideshow.descriptionGlideFactor, 3)
}
func test_titleGlideFactor() {
XCTAssertEqual(glideshow.titleGlideFactor, 2)
}
func test_captionGlideFactor() {
XCTAssertEqual(glideshow.captionGlideFactor, 1)
}
func test_descriptionFont() {
XCTAssertEqual(glideshow.descriptionFont, UIFont.systemFont(ofSize: 16, weight: .regular))
}
func test_captionFont() {
XCTAssertEqual(glideshow.captionFont, UIFont.systemFont(ofSize: 14, weight: .light))
}
func test_titleColor() {
XCTAssertEqual(glideshow.titleColor, .white)
}
func test_descriptionColor() {
XCTAssertEqual(glideshow.descriptionColor, .white)
}
func test_captionColor() {
XCTAssertEqual(glideshow.captionColor, .white)
}
func test_gradientColor() {
XCTAssertEqual(glideshow.gradientColor, UIColor.black.withAlphaComponent(0.6))
XCTAssertEqual(glideshow.isGradientEnabled, false)
glideshow.gradientColor = .orange
XCTAssertEqual(glideshow.gradientColor, .orange)
XCTAssertEqual(glideshow.isGradientEnabled, true)
}
func test_gradientHeightFactor() {
XCTAssertEqual(glideshow.gradientHeightFactor, 0.5)
XCTAssertEqual(glideshow.isGradientEnabled, false)
glideshow.gradientHeightFactor = 0.8
XCTAssertEqual(glideshow.gradientHeightFactor, 0.8)
XCTAssertEqual(glideshow.isGradientEnabled, true)
}
func test_pageIndicator() {
XCTAssertEqual(glideshow.pageIndicator!.pageIndicatorTintColor, .lightGray)
XCTAssertEqual(glideshow.pageIndicator!.currentPageIndicatorTintColor, .darkGray)
XCTAssertEqual(glideshow.pageIndicator!.numberOfPages, 0)
glideshow.items = [
GlideItem(caption: "", title: "", description: "", backgroundImage: UIImage.checkmark),
GlideItem(caption: "", title: "", description: "", backgroundImage: UIImage.checkmark)
]
XCTAssertEqual(glideshow.pageIndicator!.numberOfPages, 2)
}
}
+23 -9
View File
@@ -3,12 +3,11 @@
![Frame 3](https://user-images.githubusercontent.com/46480892/110459021-74813d80-80f2-11eb-8dcf-620489289431.png)
# Glideshow
[![Generic badge](https://img.shields.io/badge/Swift-5.3-orange.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/iOS-13.0-blue.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Version-1.0.0-orange.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/platform-ios-green.svg)](https://shields.io/)
[![Generic badge](https://img.shields.io/badge/Swift-5.3-orange.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/iOS-13.0-blue.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/Version-1.1.1-orange.svg)](https://shields.io/) [![Generic badge](https://img.shields.io/badge/platform-ios-green.svg)](https://shields.io/)
A slideshow with *pizzazz!* Glideshow adds transitions to the slideshows labels to set it apart from conventional slideshows
A slideshow with *pizzazz!* Glideshow adds transitions to the slideshows labels to set it apart from other conventional "boring" slideshows,
![video](https://user-images.githubusercontent.com/46480892/110444437-02edc300-80e3-11eb-839f-fff9f8638aa9.mov)
![ezgif com-optimize](https://user-images.githubusercontent.com/46480892/128128971-f1dcb1bb-0339-448c-bd84-1f4f06213945.gif)
## Installation
@@ -42,6 +41,8 @@ glideshow.items = [
GlideItem(description: "General Kenobi!", backgroundImage: UIImage(named: "image2")),
GlideItem(title : "Hello there", backgroundImage: UIImage(named: "image3")),
GlideItem(title : "Hello there", description: "General Kenobi!")
// Network images
GlideItem(caption : "Hello there", description: "General Kenobi!", imageURL: "[ IMAGE URL ]")
]
```
@@ -67,14 +68,27 @@ The behaviour is configurable by the following properties
| `titleColor` | Sets the `textColor` of the slide title |
| `descriptionColor` | Sets the `textColor` of the slide description |
| `captionColor` | Sets the `textColor` of the slide slide caption |
| `titleGlideFactor` | Configures the speed of the transition of the title label ( Default 3 ) |
| `titleGlideFactor` | Configures the speed of the transition of the title label ( Default 2 ) |
| `descriptionGlideFactor` | Configures the speed of the transition of the description label ( Default 3 ) |
| `captionGlideFactor` | Configures the speed of the transition of the caption label ( Default 3 ) |
| `captionGlideFactor` | Configures the speed of the transition of the caption label ( Default 1 ) |
| `pageIndicatorPosition` | Configures positon of the pge indicator |
| `placeHolderImage` | Configures slide background placeholder if a URL is specified, else `nil` |
### Work in Progress
### Contributions
* Support for Network images
* Multiple animations
A few issue to tackle
- [ ] Pass slide data through delegates
- [x] Support for Network images
- [ ] Multiple animations
- [ ] Customizable label positionings
- [ ] Code optimizations
Steps to contribution:
1. Fork the repo
2. Clone the project
3. Make your changes
4. Make a pull request
If you have any question please feel free to open an issue