11 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
6 changed files with 153 additions and 7 deletions
+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
+4 -1
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 {
+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)
}
}
+3 -3
View File
@@ -5,10 +5,9 @@
# 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.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
@@ -78,6 +77,7 @@ The behaviour is configurable by the following properties
### Contributions
A few issue to tackle
- [ ] Pass slide data through delegates
- [x] Support for Network images
- [ ] Multiple animations
- [ ] Customizable label positionings