• Stars
    star
    2,769
  • Rank 16,450 (Top 0.4 %)
  • Language
    Swift
  • License
    MIT License
  • Created about 10 years ago
  • Updated over 3 years ago

Reviews

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

Repository Details

BWWalkthrough is a simple library that helps you build custom walkthroughs for your iOS App


CocoaPods Carthage Compatible Platform Twitter

What is BWWalkthrough?

BWWalkthrough (BWWT) is a class that helps you create Walkthroughs for your iOS Apps. It differs from other similar classes in that there is no rigid template; BWWT is just a layer placed over your controllers that gives you complete freedom on the design of your views..

Preview

Video preview Here A dedicated tutorial is available on ThinkAndBuild

The class comes with a set of pre-built animations that are automatically applied to the subviews of each page. This set can be easily substituted with your custom animations.

BWWT is essentially defined by 2 classes: BWWalkthroughViewController is the Master (or Container). It shows the walkthrough and contains UI elements that are shared among all the Pages (like UIButtons and UIPageControl).

BWWalkthroughPageViewController defines every single Page that is going to be displayed with the walkthrough inside the Master.

What it's not?

BWWT is not a copy-paste-and-it-just-works class and it is not a fixed walkthrough template. If you need a simple no-configuration walkthrough, BWWT is not the right choice.

Installation

Note: There is a known issue with IBOutlets and Carthage that prevents Outlets from working correctly. I see something similar reported for other projects too. My suggestion is to follow the manual installation instructions, as it is just matter of drag and drop 2 files in your project. I know you cannot update the library automatically going that route... but IBOutlets are needed for a project like BWWalkthrough.

With CocoaPods

BWWalkthrough is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "BWWalkthrough"

With Carthage

Include this line into your Cartfile:

github "ariok/BWWalkthrough"

Run carthage update to build the framework and drag the built BWWalkthrough.framework into your Xcode project.

With Swift Package Manager

// swift-tools-version:5.0	
import PackageDescription
	
let package = Package(
name: "YourTestProject",
platforms: [
    .iOS(.v10),
],
dependencies: [
    .package(url: "https://github.com/ariok/BWWalkthrough/.git", from: "4.0.1")
],
targets: [
    .target(name: "YourTestProject", dependencies: ["BWWalkthrough"])
]
)

And then import wherever needed: import BWWalkthrough

Adding it to an existent iOS Project via Swift Package Manager

  1. Using Xcode 11 go to File > Swift Packages > Add Package Dependency
  2. Paste the project URL: https://github.com/ariok/BWWalkthrough
  3. Click on next and select the project target

If you have doubts, please, check the following links:

How to use

Creating Swift Packages

After successfully retrieved the package and added it to your project, just import BWWalkthrough and you can get the full benefits of it.

Manually

Include the BWWalkthrough/BWWalkthroughViewController.swift and the BWWalkthrough/BWWalkthroughPageViewController.swift files into your project.

How to use it?

Define the Master

Add a new controller to the Storyboard and set its class as BWWalkthroughViewController. This is the Master controller where every page will be attached.

Here you can add all the elements that have to be visible in all the Pages.

There are 4 prebuilt IBOutlets that you can attach to your elements to obtain some standard behaviours: UIPageControl (pageControl), UIButton to close/skip the walkthrough (closeButton) and UIButtons to navigate to the next and the previous page (nextButton, prevButton). You can take advantage of these IBOutlets just creating your UI elements and connecting them with the outlets of the Master controller.

Define the Pages

Add a new controller to the Storyboard and set it has BWWalkthroughPageViewController. Define your views as you prefer.

Attach Pages to the Master

Here is an example that shows how to create a walkthrough reading data from a dedicated Storyboard:

// Get view controllers and build the walkthrough
let stb = UIStoryboard(name: "Walkthrough", bundle: nil)
let walkthrough = stb.instantiateViewControllerWithIdentifier(“Master”) as BWWalkthroughViewController
let page_one = stb.instantiateViewControllerWithIdentifier(“page1) as UIViewController
let page_two = stb.instantiateViewControllerWithIdentifier(“page2) as UIViewController
let page_three = stb.instantiateViewControllerWithIdentifier(“page3) as UIViewController

// Attach the pages to the master
walkthrough.delegate = self
walkthrough.add(viewController:page_one)
walkthrough.add(viewController:page_two)
walkthrough.add(viewController:page_three)

Prebuilt Animations

You can add animations without writing a line of code. You just implement a new Page with its subviews and set an animation style using the runtime argument {Key: animationType, type: String} via IB. The BWWalkthrough animates your views depending on the selected animation style.

At the moment (WIP!) the possible value for animationsType are: Linear, Curve, Zoom and InOut The speed of the animation on the X and Y axes must be modified using the runtime argument {key: speed type:CGPoint}, while the runtime argument {key: speedVariance type: CGPoint} adds a speed variation to the the subviews of the page depending on the hierarchy position.

Example Let’s say that we have defined these runtime arguments for one of the Pages:

  • animationType: "Linear"
  • speed: {0,1}
  • speedVariance: {0,2}

The subviews of the Page will perform a linear animation adding speed to the upfront elements depending on speedVariance. So if we have 3 subviews, the speed of each view will be:

  • view 0 {0,1+2}
  • view 1 {0,1+2+2}
  • view 2 {0,1+2+2+2}

creating the infamous parallax effect.

Exclude Views from automatic animations

You might need to avoid animations for some specific subviews.To stop those views to be part of the automatic BWWalkthrough animations you can just specify a list of views’ tags that you don’t want to animate. The Inspectable property staticTags (available from version ~> 0.6) accepts a String where you can list these tags separated by comma (“1,3,9”). The views indicated by those tags are now excluded from the automatic animations.

Custom Animations

Each page of the walkthrough receives information about its normalized offset position implementing the protocol BWWalkthroughPage, so you can extend the prebuilt animations adding your super-custom-shiny-woah™ animations depending on this value (here is a simple example)

func walkthroughDidScroll(position: CGFloat, offset: CGFloat) {
    var tr = CATransform3DIdentity
    tr.m34 = -1/500.0
    titleLabel?.layer.transform = CATransform3DRotate(tr, CGFloat(M_PI)*2 * (1.0 - offset), 1, 1, 1)
}

Delegate

The BWWalkthroughViewControllerDelegate protocol defines some useful methods that you can implement to get more control over the Walkthrough flow.

@objc protocol BWWalkthroughViewControllerDelegate {
        @objc optional func walkthroughCloseButtonPressed()
        @objc optional func walkthroughNextButtonPressed()
        @objc optional func walkthroughPrevButtonPressed()
        @objc optional func walkthroughPageDidChange(pageNumber:Int)
}

More Repositories

1

TB_TwitterUI

This is the code for the ThinkAndBuild tutorial: "Implementing the Twitter App UI" (WIP)
Objective-C
521
star
2

TB_CircularSlider

This is the code for the tutorial "How to create a custom control in iOS" from http://www.thinkandbuild.it
Objective-C
322
star
3

BWCircularSlider

This is the code for the ThinkAndBuild tutorial: "How to build custom controls in Swift"
Swift
126
star
4

TB_TableAnimation

Objective-C
107
star
5

TB_CustomTransition

This is the code for the tutorial "How to create custom ViewController transitions"
Objective-C
106
star
6

codeigniter-boilerplate

[DISCONTINUED] A Boilerplate to quickly get you up and running with Codeigniter with the best practises applied from html5boilerplate. Plus, it easily included Js, Css and Google-Fonts in your projects and manages pages through a simple Main-Template/Content-Views system.
PHP
105
star
7

TB_3DCoreAnimation

This is the code for the tutorial "Introduction to 3D drawing in Core Animation" from http://www.thinkandbuild.it
Objective-C
98
star
8

TB_iOS7Transition

The code for the tutorial http://www.thinkandbuild.it/ios7-custom-transition/ ‎
Objective-C
80
star
9

TB_ControllerContainment

The code for the tutorial from ThinkandBuild.it about View Controller Containment
Objective-C
61
star
10

TB_ProgrammaticallyAutoLayout

This is the code for the tutorial "Learn to love Auto Layout... programmatically". You can find it on ThinkAndBuild.it :)
Objective-C
58
star
11

TB_PeriscopePTR

Swift
57
star
12

TB_InteractiveTransitions

Source code for the tutorial "Interactive Transitions"
Objective-C
47
star
13

TB_CustomUIElement

Implementing custom UI elements with IBDesignable. Enjoy the full tutorial on http://www.thinkandbuild.it
Swift
39
star
14

TB_InteractiveNotifications

Swift
37
star
15

TB_TouchAnimation

This is the code for the tutorial "Playing around with Core Graphics, Core Animation and Touch Events" from http://www.thinkandbuild.it
Objective-C
23
star
16

TB_ForceTouchSelector

Swift
21
star
17

TB_AutoLayout

This is the code for the tutorial "Learn to love Auto Layout" from http://www.thinkandbuild.it
Objective-C
20
star
18

TB_Walkthrough

This is the code for the BWWalkthrough tutorial available on ThinkAndBuild.it
Swift
17
star
19

VIPER-S

A custom swift implementation of VIPER with a detailed explanation on ThinkAndBuild.it.
HTML
14
star
20

Exportabler

A sketch plugin to easily export @2x and @3x iOS assets.
JavaScript
13
star
21

SpeedGraphics

A Core Graphics helper for iOS and OSX
Objective-C
7
star
22

WRAPI

Objective-c Wordreference.com API wrapper
Objective-C
4
star
23

TB_UITesting

Swift
4
star
24

Laravel-Dribbble

Laravel Bundle: Dribbble API Wrapper
PHP
2
star
25

SCSS-basics

A simple set of mixin for new blank projects
1
star