Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0f6ff38a71 | |||
| e072b40ea5 | |||
| de1e60ee6b | |||
| f469bd70ab | |||
| 8d19bad3e9 | |||
| 689f0b1bfb | |||
| fcdf49d4a4 | |||
| 52b001769e | |||
| 09aa06bec1 | |||
| 35c8f76b22 | |||
| 249fd977e3 |
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,9 @@
|
||||
# Glideshow
|
||||
[](https://shields.io/) [](https://shields.io/) [](https://shields.io/) [](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,
|
||||
|
||||
|
||||

|
||||

|
||||
|
||||
## 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
|
||||
|
||||
Reference in New Issue
Block a user