• This repository has been archived on 28/Mar/2019
  • Stars
    star
    260
  • Rank 157,160 (Top 4 %)
  • Language
    Swift
  • License
    MIT License
  • Created almost 10 years ago
  • Updated about 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

SAParallaxViewControllerSwift realizes parallax scrolling with blur effect. In addition, it realizes seamless opening transition.

SAParallaxViewControllerSwift

Platform Language License Version

SAParallaxViewControllerSwift realizes parallax scrolling with blur effect. In addition, it realizes seamless opening transition.

Features

  • Parallax scrolling
  • Parallax scrolling with blur accessory view
  • Seamlees opening transition
  • Support Swift2.3
  • Support Swift3

Installation

CocoaPods

SAParallaxViewControllerSwift is available through CocoaPods. If you have cocoapods 0.36 beta or greater, you can install it, simply add the following line to your Podfile:

pod "SAParallaxViewControllerSwift"

Manually

Add the SAParallaxViewControllerSwift directory to your project.

Usage

If you install from cocoapods, You have to white import SAParallaxViewControllerSwift.

Extend SAParallaxViewController like this.

class ViewController: SAParallaxViewController {
    override init() {
        super.init()
    }

    override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
    }

    required init(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }

    override func viewDidLoad() {
        super.viewDidLoad()
    }
}

If you want to use UICollectionViewDataSource, implement extension like this. You can set image with cell.setImage(). You can add some UIView member classes to cell.containerView.accessoryView.

extension ViewController: UICollectionViewDataSource {
    override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = super.collectionView(collectionView, cellForItemAt: indexPath) as! SAParallaxViewCell

        let index = indexPath.row % 6
        let imageName = String(format: "image%d", index + 1)
        if let image = UIImage(named: imageName) {
            cell.setImage(image)
        }
        let title = ["Girl with Room", "Beautiful sky", "Music Festival", "Fashion show", "Beautiful beach", "Pizza and beer"]
        let label = UILabel(frame: cell.containerView.accessoryView.bounds)
        label.textAlignment = .Center
        label.text = title[index]
        label.textColor = .whiteColor()
        label.font = .systemFontOfSize(30)
        cell.containerView.accessoryView.addSubview(label)

        return cell
    }
}

If you want to use UICollectionViewDelegate, implement extension like this.

You must copy cell.containerView to viewController.trantisionContainerView because to use opening transition. When you copy them, use containerView.setViews(cells: cells, view: view). Set viewController.transitioningDelegate as self, finally call self.presentViewController().

extension ViewController: UICollectionViewDelegate {
    override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        super.collectionView(collectionView, didSelectItemAt: indexPath)

        guard let cells = collectionView.visibleCells as? [SAParallaxViewCell] else { return }
        let containerView = SATransitionContainerView(frame: view.bounds)
        containerView.setViews(cells, view: view)

        let viewController = DetailViewController()
        viewController.transitioningDelegate = self
        viewController.trantisionContainerView = containerView

        present(viewController, animated: true, completion: nil)
    }
}

Extend SADetailViewController like this.

SADetailViewController is detail view controller for parallax cell.

class DetailViewController: SADetailViewController {
    override init() {
        super.init()
    }

    override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
    }

    required init(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }

    override func viewDidLoad() {
        super.viewDidLoad()
    }
}

Customize

You can change parallax start position with function of cell.containerView.

func setParallaxStartPosition(#y: CGFloat)

You can change height of cell.containerView.accessoryView.

func setAccessoryViewHeight(height: CGFloat)

You can change blur size of cell.containerView.accessoryView.

func setBlurSize(size: CGFloat)

You can change blur color of cell.containerView.accessoryView.

func setBlurColor(color: UIColor)

You can change blur color alpha of cell.containerView.accessoryView.

func setBlurColorAlpha(alpha: CGFloat)

Requirements

Author

Taiki Suzuki, [email protected]

License

SAParallaxViewControllerSwift is available under the MIT license. See the LICENSE file for more info.

More Repositories

1

ReverseExtension

A UITableView extension that enables cell insertion from the bottom of a table view.
Swift
1,675
star
2

SAHistoryNavigationViewController

SAHistoryNavigationViewController realizes iOS task manager like UI in UINavigationContoller. Support 3D Touch!
Swift
1,569
star
3

iOSDesignPatternSamples

This is Github user search demo app which made by many variety of design patterns. You can compare differences in MVC, MVP, MVVM and Flux.
Swift
690
star
4

URLEmbeddedView

URLEmbeddedView automatically caches the object that is confirmed the Open Graph Protocol.
Swift
650
star
5

SABlurImageView

You can use blur effect and it's animation easily to call only two methods.
Swift
557
star
6

MisterFusion

MisterFusion is Swift DSL for AutoLayout. It is the extremely clear, but concise syntax, in addition, can be used in both Swift and Objective-C. Support Safe Area and Size Class.
Swift
314
star
7

SAInboxViewController

UIViewController subclass inspired by "Inbox by google" animated transitioning.
Swift
297
star
8

SACollectionViewVerticalScalingFlowLayout

UICollectionViewLayout that performs scaling up and down automatically on disappearing cells, and applies UIDynamics.
Swift
272
star
9

MartyJunior

You can change tab contents with swipe gesture on middle of UITableView!!
Swift
245
star
10

TheAnimation

Type-safe CAAnimation wrapper. It makes preventing to set wrong type values.
Swift
224
star
11

GitHubSearchWithSwiftUI

SwiftUI and Combine based GitHubSearch example.
Swift
205
star
12

DuctTape

๐Ÿ“ฆ KeyPath dynamicMemberLookup based syntax sugar for Swift.
Swift
175
star
13

HoverConversion

HoverConversion realized vertical paging with UITableView. UIViewController will be paged when reaching top or bottom of UITableView contentOffset.
Swift
163
star
14

NoticeObserveKit

NoticeObserveKit is type-safe NotificationCenter wrapper.
Swift
150
star
15

FluxCapacitor

This is what makes the Flux design pattern possible.
Swift
123
star
16

MSAlertController

MSAlertController has same feature at UIAlertViewController.
Objective-C
117
star
17

Prex

๐Ÿ”Unidirectional data flow architecture with MVP and Flux combination for Swift
Swift
109
star
18

QiitaWithFluxSample

A sample project uses Flux and MVVM features with RxSwift.
Swift
104
star
19

Continuum

NotificationCenter based Lightweight UI / AnyObject binder.
Swift
80
star
20

Ricemill

๐ŸŒพ โ™ป๏ธ ๐Ÿš Unidirectional Input / Output framework with Combine. Supports both of SwiftUI and UIKit.
Swift
63
star
21

PickerButton

PickerButton is subclass of UIButton that presents UIPickerView in UIKeyboard.
Swift
44
star
22

SASecretCommandViewController

You can use secret command with swipe gesture and A, B button. Show a secret mode you want!
Swift
43
star
23

ArtShredder

๐Ÿ“ฑBanksy Shredder for iOS
Swift
42
star
24

SplittableViewKit

A cell of IndexPath(row: 0, section: 0) in UITableView is automatically moved to left view when device rotated.
Swift
37
star
25

UILayoutBuilder

An AutoLayout DSL that intuitive syntax and viewable hierarchy.
Swift
37
star
26

SAWaveToast

Show text with wave animated background and floating animation.
Swift
34
star
27

TicTacToe-SwiftUI

Unidirectional data flow tic-tac-toe sample with SwiftUI.
Swift
23
star
28

SafeAreaExtension

You can handle safeAreaInsets changes of every UIView.
Swift
20
star
29

SABlurImageViewObjc

Objective-C
19
star
30

AnyObservableObject

Swift
18
star
31

ReuseCellConfigure

You can configure ReusableCell without casting!
Swift
17
star
32

GitHubClientTestSample

A GitHub client sample for User Action Logs testing.
Swift
17
star
33

MOAlertController

Objective-C
15
star
34

ConnpassAttendanceChecker

An attendance checking iOS application for https://connpass.com
Swift
14
star
35

SimplestCounterSample

This is simplest Counter App written in many variety of design patterns.
Swift
14
star
36

MyFirstAndroidPractice

I had began learning Android App development since Aug 2021. This is my first Android app project for practice development.
Kotlin
11
star
37

GithubKitForSample

Swift
11
star
38

DiffMVPAndMVVM

MVP and MVVM implementations and test code sample.
Swift
9
star
39

YouTubeSampleWithMVP-DiffableDataSource

This is a YouTube like iOS app sample with the Model-View-Presenter pattern.
Swift
9
star
40

Connpass

Swift
8
star
41

LayoutGuaranteedView

LayoutGuaranteedView is a Phantom Type view holder. It guaranteed that a view had laid out after execute `guaranteeLayout` function.
Swift
8
star
42

Necom

๐Ÿˆ New concept of MVP with Swift
Swift
7
star
43

RxAnyDispatcher

A observer(or observable)-only `Dispatcher` that is used in Flux.
Swift
7
star
44

kmm-with-spm-buildtoolplugin-sample

Kotlin
6
star
45

QiitaApiClient

API client for http://qiita.com/.
Swift
6
star
46

LazyInitializedViewModelInjectionSample

Swift
4
star
47

iOSDC2022LightningTalkSample

Swift
3
star
48

unio-kt

๐Ÿ”„ kProperty based Unidirectional Input / Output framework with Flow.
Kotlin
2
star
49

ReusableView

Swift
1
star
50

LayeredLayout

Swift
1
star
51

ViewIsolatedViewController

Swift
1
star