Giter Site home page Giter Site logo

hyperoslo / presentation Goto Github PK

View Code? Open in Web Editor NEW
3.0K 76.0 189.0 5.44 MB

:bookmark_tabs: Presentation helps you to make tutorials, release notes and animated pages.

Home Page: hyper.no

License: Other

Swift 97.67% Ruby 2.33%
presentation tutorials pages slides ui swift ios

presentation's Introduction

⚠️ DEPRECATED, NO LONGER MAINTAINED

Presentation logo

Version CI Status Carthage Compatible Swift License Platform

Looking for the easiest way of presenting something in your iOS app? Then you are in the right place. Presentation will help you make your tutorials, release notes and any kind of animated pages with the minimum amount of effort.

Presentation includes the following features:

  • Custom positioning: You can use Position for percentage-based position declaration.
  • Content: View model used for custom positioning and animations. It translates your percents to AutoLayout constraints behind the scenes.
  • Slides: You can use any kind of UIViewController as a slide. SlideController is your good friend if you want to use custom positioning and animation features on your pages.
  • Background: You can add views that are visible across all the pages. Also it's possible to animate those views during the transition to the specific page.
  • Animations: You can easily animate the appearance of a view on the specific page.

Presentation works both on the iPhone and the iPad. You can use it with both Swift and Objective-C.

Try one of our demos to see how it works:

pod try Presentation

Table of Contents

Usage

Presentation controller

import Presentation

let viewController1 = UIViewController()
viewController1.title = "Controller A"

let viewController2 = UIViewController()
viewController2.title = "Controller B"

let presentationController = PresentationController(pages: [viewController1, viewController2])

If that's the only thing you need, look into Pages.

Position

Position is percentage-based; you can use left, right, top, bottom to set a position.

let position = Position(left: 0.3, top: 0.4)

Content view model

Content view model is a layer between UIView and Position. The current position is the center of a view by default, but can also be changed to the origin of a view.

let view = UIView(frame: CGRect(x: 0, y: 0, width: 200, height: 100))
let position = Position(left: 0.3, top: 0.4)

let centeredContent = Content(view: label, position: position)
let originContent = Content(view: label, position: position, centered: false)

Slides

let label = UILabel(frame: CGRect(x: 0, y: 0, width: 200, height: 100))
label.text = "Slide 1"

let position = Position(left: 0.3, top: 0.4)
let content = Content(view: label, position: position)

let controller = SlideController(contents: [content])

presentationController.add([controller])

Page animations

let contents = ["Slide 1", "Slide 2", "Slide 3"].map { title -> Content in
  let label = UILabel(frame: CGRect(x: 0, y: 0, width: 200, height: 100))
  label.text = title

  let position = Position(left: 0.3, top: 0.4)

  return Content(view: label, position: position)
}

var slides = [SlideController]()

for index in 0...2 {
  let content = contents[index]
  let controller = SlideController(contents: [content])
  let animation = TransitionAnimation(
    content: content,
    destination: Position(left: 0.5, top: content.initialPosition.top),
    duration: 2.0,
    dumping: 0.8,
    reflective: true)
  controller.add(animations: [animation])

  slides.append(controller)
}

presentationController.add(slides)

Background views

let imageView = UIImageView(image: UIImage(named: "image"))
let content = Content(view: imageView, position: Position(left: -0.3, top: 0.2))

presentationController.addToBackground([content])

// Add pages animations
presentationController.add(animations: [
  TransitionAnimation(content: content, destination: Position(left: 0.2, top: 0.2))],
  forPage: 0)

presentationController.add(animations: [
  TransitionAnimation(content: content, destination: Position(left: 0.3, top: 0.2))],
  forPage: 1)

Installation

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

pod 'Presentation'

Presentation is also available through Carthage. To install just write into your Cartfile:

github "hyperoslo/Presentation"

Components

Presentation wouldn’t be possible without the help of these components:

  • Pages: The easiest way of setting up a UIPageViewController

  • Cartography: Helps you set up your Auto Layout constraints declaratively and without any stringly typing!

Contributing

Please see our playbook for guidelines on contributing.

Credits

Hyper made this. We’re a digital communications agency with a passion for good code and delightful user experiences. If you’re using this library we probably want to hire you (we consider remote employees, too; the only requirement is that you’re awesome).

License

Presentation is available under the MIT license. See the LICENSE.

presentation's People

Contributors

3lvis avatar alexasfb avatar chrilith avatar delebedev avatar econa avatar jgorset avatar onmyway133 avatar ramongilabert avatar richardtop avatar vadymmarkov avatar zenangst avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

presentation's Issues

Tapping on UINavigationController disables swiping

In both samples, tapping on the UINavigationController's next or previous buttons disables the swiping of the pages.

The swiping should still be allowed when the user uses one of these nav buttons.

Gestures are not working

If I use gestures and swipe left,right text changes but parallax effect doesn't work. However if I use Previous and Next page button animations work as it intended.
anim

Scene naming

Can we rename Scene to Background? Makes it easier to understand the purpose without having to read documentation about it.

dependency update

Please update your Cartography dependency from "> 0.5.0" to "> 0.6.0" to support swift 2.0

Demo with parallax scrolling

It's about the demo I've presented today. Have 2 questions to discuss:

  • What is the best name for it - Parallax, ParallaxSlides, MagicMove or something else?
  • Should we add a mark in the name that it's iPad only demo (related to both demos we have)?
  • Do we need to put some text on the each slide or that's enough to have jsut images, animations and so on?

Declarations in extensions cannot override yet

Getting the following error on line 31 of PresentationController.swift

Ambiguous use of 'add'

and the following error on line 122 of PresentationController.swift

Declarations in extensions cannot override yet

Function add is as below :

// MARK: - Content

extension PresentationController {

  open override func add(_ viewControllers: [UIViewController]) {
    for case let controller as SlideController in viewControllers  {
      slides.append(controller)
    }
    super.add(viewControllers)
  }

Using Swift 3.2 language version in Xcode 9.2

Bug: animation glitch / improper scrolling behavior

Run a demo, then:
steps to reproduce the bug:

  1. Press Next Page or scroll to the next / previous page
  2. While application keeps inertial scrolling (fingers are off the screen), try to touch and scroll text label only. You have to be fast.
  3. After view has scrolled to the other page, try to scroll it again. You'll see the glitch.

Start:
screen shot 2015-06-10 at 10 29 58
Pay attention to the positions of background objects on the screen.

Before glitch:
screen shot 2015-06-10 at 10 30 04

The positions of the background objects are the same, while label has scrolled to another one. If you try to touch screen and scroll after, you'll see the glitch.

Issue is reproducible in both of demos.

add '@objc' to expose this instance method to Objective-C

Getting the following error while building with this library

[12:19:43]: ▸ <...>/Pods/Presentation/Source/PresentationController.swift:112:8: note: add '@objc' to expose this instance method to Objective-C
[12:19:43]: ▸ func updateAnimationTimer(_ timer: Timer) {
[12:19:43]: ▸ ^
[12:19:43]: ▸ @objc

Build Env is as follows :

+-------------+----------------------------------------------------------+
| Build environment |
+-------------+----------------------------------------------------------+
| xcode_path | <...>/Xcode/Xcode_9_0_0/Xcode_9_0_0.app |
| gym_version | 2.58.0 |
| sdk | iPhoneOS11.0.sdk |
+-------------+----------------------------------------------------------+

Swift 3.0 support

Any swift 3.0 support?
Getting "Overriding non-open instance method outside of its defining module" in 2 locations

PresentationController only in portrait mode

How do I lock the presentationController's orientation to display the content only in portrait?
I tried this:

extension PresentationController {
    open override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
        return .portrait
    }
}

but didn't work

How should I do after called goTo: app freeze for a little while

I put a skip button on every screen to go to particular screen.
goTo(index:) will be called when I press the skip button.

Nevertheless, the screen will freeze for a little while after the screen come.
I have to wait a bit then I can scroll back to previous screen.

Do I miss something ?
Thanks in advance.

Hi do a swift 4 version is on schedule ?

Hi Presentation Teams.
I would like to know if you're going to update, and if yes when, the actual version of Presentation.
I wish you good day !
And thx in advance for an answer !

Not compatible with Swift 2.0

This looks AMAZING. I really want to use it for my latest project but it's got a few issues working with Swift 2.0. I can try to fix it but wondering if you guys are already on it?

Swift 2.2

My project is written in Swift 2.2. Is there anyway I can get this framework running using Cocoapods?

I've tried all versions but nothing is compilable.

Vertical transitions don't work with gestures

Hi... awesome library!

I was just playing with this and found that in the tutorial example if you used something like this:

    presentationController.addAnimations([
        TransitionAnimation(content: content1, destination: Position(left: 0.3, top: 0.2)),
        TransitionAnimation(content: content2, destination: Position(right: 0.4, top: 0.22)),
        TransitionAnimation(content: content3, destination: Position(left: 0.5, top: 0.6))
      ], forPage: 1)

...which is simply adding a vertical transition to the third image. And then add similar code for the other pages as well.

It works if you press the next and previous buttons, but the image gets stuck when using the swipe gestures.
Although, if you change it to horizontal transitions, it works fine.

Not compatible with Swift 4.2

Cannot inherit from class 'PagesController' (compiled with Swift 4.1.50) because it has overridable members that could not be loaded in Swift 4.2.1

How to dismiss the tutorial ?

Hi !

Thanks for this great library !
I'm trying to implement it at the opening of my app but at the end of the tutorial, I want to change the "next" button with a "Close" button or something like that (or putting a big "Start using the app" button in the middle of the screen"...)

Do you have any hints on how to do that ?

Thanks !

Smaller gif in README

Even with Safari in full size I cannot see the full screen, I feel with that gif you cannot appreciate all the work that the pod contains, I'd do it a bit smaller, what do you think?

How can I use autolayout with this library?

Hi,

How can I use autolayout with this library? I see the doc and example apps are hardcoding the view frames, while the content positioning is relative (with percentages). How can I combine these two different approaches?

If it's possible, can you add examples in the doc and example apps? If it's not, can you add support for it?

What I've been doing is hardcoding the frames too, and calculating the percentage they represent relative to the view (i.e. to the screen). That way I can combine those calculated percentages and the percentages that Position objects expect.

For example, let's say I add an image and set a frame size of 200 x 100 points. Then I calculate the size percentage to the screen width and height, which let's suppose it's 0.5 x 0.2. Then say I position this image at Position(left:0.6, top:0.4). Now I can, for example, add another image aligned to the top-center the first one. Since the image is positioned at 0.4 vertically, and it's height relation is 0.2, the top would be at 0.4 - 0.2/2 = 0.3, so the top center would be at Position(left:0.6, top:0.3). The calculation is easy but it would be great if the library could do this for you.

Any help will be appreciated. Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.