-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
130 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// | ||
// SlidableImageFactory.swift | ||
// SlidableImage | ||
// | ||
// Created by Pawel Bednorz on 04.03.2017. | ||
// Copyright © 2017 Quver. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
extension SlidableImage { | ||
|
||
struct Factory { | ||
|
||
static func makeSliderCircle(sliderImage: UIImage? = nil) -> UIView { | ||
let frame = CGRect(x: 0, y: 0, width: 50, height: 50) | ||
let circle = UIView(frame: frame) | ||
|
||
guard let sliderImage = sliderImage else { | ||
return ArrowsView(frame: frame) | ||
} | ||
|
||
circle.layer.cornerRadius = circle.bounds.width / 2 | ||
|
||
let imageView = UIImageView(image: sliderImage) | ||
imageView.contentMode = .scaleAspectFill | ||
circle.addSubview(imageView) | ||
imageView.center = circle.center | ||
|
||
return circle | ||
} | ||
|
||
static func makeContainer(image: UIImage, frame: CGRect) -> UIImageView { | ||
let imageView = UIImageView(frame: frame) | ||
imageView.image = image | ||
imageView.contentMode = .scaleAspectFill | ||
|
||
return imageView | ||
} | ||
|
||
static func makeMaskRect(for maskLocation: CGFloat, bounds: CGRect, slideDirection: Direction) -> CGRect { | ||
switch slideDirection { | ||
case .left: | ||
return CGRect(x: maskLocation, | ||
y: bounds.minY, | ||
width: bounds.width, | ||
height: bounds.height) | ||
case .right: | ||
return CGRect(x: bounds.minX, | ||
y: bounds.minY, | ||
width: maskLocation, | ||
height: bounds.height) | ||
case .top: | ||
return CGRect(x: bounds.minX, | ||
y: maskLocation, | ||
width: bounds.width, | ||
height: bounds.height) | ||
case .bottom: | ||
return CGRect(x: bounds.minX, | ||
y: bounds.minY, | ||
width: bounds.width, | ||
height: maskLocation) | ||
} | ||
} | ||
} | ||
|
||
} |
Binary file added
BIN
+6.68 KB
...iffs/ArrowsViewSpec/diff_Draw_arrows__frame_initialized__is_correct_draw@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+14 KB
...fs/ArrowsViewSpec/failed_Draw_arrows__frame_initialized__is_correct_draw@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+15.9 KB
...ArrowsViewSpec/reference_Draw_arrows__frame_initialized__is_correct_draw@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+490 KB
SlidableImageTests/FailureDiffs/SlidableImageSpec/diff_Border__has_border@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+512 KB
...ableImageTests/FailureDiffs/SlidableImageSpec/diff_Border__hasn_t_border@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+512 KB
...alization__with_images__only_required_parameters__has_correct_screenshot@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+508 KB
...on__with_images__with_custom_slide_direction__is_initialized_with_bottom@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+517 KB
...tion__with_images__with_custom_slide_direction__is_initialized_with_left@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+512 KB
...ion__with_images__with_custom_slide_direction__is_initialized_with_right@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+519 KB
...ation__with_images__with_custom_slide_direction__is_initialized_with_top@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+32.2 KB
...ialization__with_views__only_required_parameters__has_correct_screenshot@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.68 MB
SlidableImageTests/FailureDiffs/SlidableImageSpec/failed_Border__has_border@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.79 MB
...leImageTests/FailureDiffs/SlidableImageSpec/failed_Border__hasn_t_border@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.79 MB
...alization__with_images__only_required_parameters__has_correct_screenshot@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.66 MB
...on__with_images__with_custom_slide_direction__is_initialized_with_bottom@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.82 MB
...tion__with_images__with_custom_slide_direction__is_initialized_with_left@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.79 MB
...ion__with_images__with_custom_slide_direction__is_initialized_with_right@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.87 MB
...ation__with_images__with_custom_slide_direction__is_initialized_with_top@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+44.3 KB
...ialization__with_views__only_required_parameters__has_correct_screenshot@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.69 MB
...leImageTests/FailureDiffs/SlidableImageSpec/reference_Border__has_border@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.79 MB
...mageTests/FailureDiffs/SlidableImageSpec/reference_Border__hasn_t_border@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.79 MB
...alization__with_images__only_required_parameters__has_correct_screenshot@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.66 MB
...on__with_images__with_custom_slide_direction__is_initialized_with_bottom@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.82 MB
...tion__with_images__with_custom_slide_direction__is_initialized_with_left@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.79 MB
...ion__with_images__with_custom_slide_direction__is_initialized_with_right@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.87 MB
...ation__with_images__with_custom_slide_direction__is_initialized_with_top@2x.png
Oops, something went wrong.
Binary file added
BIN
+45.5 KB
...ialization__with_views__only_required_parameters__has_correct_screenshot@2x.png
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.