Jamel  O'Reilly

Jamel O'Reilly

1659125940

PeekView: Supports Peek, Pop and Preview Actions for iOS Devices

PeekView

When implementing peek, pop and preview actions with 3D Touch, you may want to support such features for users accessing your app from older devices that don't provide 3D Touch capibility. PeekView hence can be used as an alternative in such case.

Note

Things that need improving

  • Better solution for Objective-C integration (the current is sort of hacky!)
  • Better documenting in code
  • Content view panned: Smoother animation
  • Action style: Selected functionality
  • More customizable UI if needed (requests are welcome)
  • Bug fixes if any

Requirements

  • iOS 8 and later
  • Swift 5 & Xcode 10.2
  • If you wish to work with Swift 2.3, check out branch swift23

Getting Started

Install using CocoaPods

Just add the following line in to your pod file:

pod 'PeekView'

Manual Install

Drag and drop folder named Source in your project and you're done.

Usage

  • Add UILongPressGestureRecognizer to the view you want to peek (i.e table view cell, image, hypertext, etc.)
  • Create a UIViewController instance as the content of your peek view; then set your desired frame for the content view. It's recommended to leave a 15px padding for both left and right margin of your content view.
  • If you want to include preview actions, prepare an array containing title of the buttons and its preview style. Don't forget to prepare completion handlers for when each button is tapped.

Sample snippet:

  let options = [ 
    PeekViewAction(title: "Option 1", style: .Destructive), 
    PeekViewAction(title: "Option 2", style: .Default), 
    PeekViewAction(title: "Option 3", style: .Selected) ]
  PeekView().viewForController(
  parentViewController: self, 
  contentViewController: controller, 
  expectedContentViewFrame: frame, 
  fromGesture: gestureRecognizer, 
  shouldHideStatusBar: true, 
  withOptions: options, 
  completionHandler: { optionIndex in
                    switch optionIndex {
                    case 0:
                        print("Option 1 selected")
                    case 1:
                        print("Option 2 selected")
                    case 2:
                        print("Option 3 selected")
                    default:
                        break
                    }
                })

Be sure to check out the demo code for better understanding of the usage.

As for Objective-C integration, a slightly different static function should be used, in which the menuOptions array is expected to be an NSArray of NSDictionary's. Please check the snippet below:


    NSArray *options = @[@{@"Option 1": @(PeekViewActionStyleDefault)},
                         @{@"Option 2": @(PeekViewActionStyleDestructive)}];
    
    UIViewController *contentViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"previewVC"];
    
    [PeekView viewForControllerWithParentViewController:self
                                  contentViewController:contentViewController
                               expectedContentViewFrame:CGRectMake(0, 0, 280, 400)
                                            fromGesture:gesture
                                    shouldHideStatusBar:YES
                                            withOptions:options
                                      completionHandler:nil];

ARC

PeekView uses ARC. If you are using PeekView in a non-arc project, you will need to set a -fobjc-arc compiler flag on every PeekView source files. To set a compiler flag in Xcode, go to your active target and select the "Build Phases" tab. Then select PeekView source files, press Enter, insert -fobjc-arc and then "Done" to enable ARC for PeekView.

Contributing

Contributions for bug fixing or improvements are welcome. Feel free to submit a pull request.

Author: itsmeichigo
Source Code: https://github.com/itsmeichigo/PeekView
License: MIT license

#ios #swift 

What is GEEK

Buddha Community

PeekView: Supports Peek, Pop and Preview Actions for iOS Devices
Jamel  O'Reilly

Jamel O'Reilly

1659125940

PeekView: Supports Peek, Pop and Preview Actions for iOS Devices

PeekView

When implementing peek, pop and preview actions with 3D Touch, you may want to support such features for users accessing your app from older devices that don't provide 3D Touch capibility. PeekView hence can be used as an alternative in such case.

Note

Things that need improving

  • Better solution for Objective-C integration (the current is sort of hacky!)
  • Better documenting in code
  • Content view panned: Smoother animation
  • Action style: Selected functionality
  • More customizable UI if needed (requests are welcome)
  • Bug fixes if any

Requirements

  • iOS 8 and later
  • Swift 5 & Xcode 10.2
  • If you wish to work with Swift 2.3, check out branch swift23

Getting Started

Install using CocoaPods

Just add the following line in to your pod file:

pod 'PeekView'

Manual Install

Drag and drop folder named Source in your project and you're done.

Usage

  • Add UILongPressGestureRecognizer to the view you want to peek (i.e table view cell, image, hypertext, etc.)
  • Create a UIViewController instance as the content of your peek view; then set your desired frame for the content view. It's recommended to leave a 15px padding for both left and right margin of your content view.
  • If you want to include preview actions, prepare an array containing title of the buttons and its preview style. Don't forget to prepare completion handlers for when each button is tapped.

Sample snippet:

  let options = [ 
    PeekViewAction(title: "Option 1", style: .Destructive), 
    PeekViewAction(title: "Option 2", style: .Default), 
    PeekViewAction(title: "Option 3", style: .Selected) ]
  PeekView().viewForController(
  parentViewController: self, 
  contentViewController: controller, 
  expectedContentViewFrame: frame, 
  fromGesture: gestureRecognizer, 
  shouldHideStatusBar: true, 
  withOptions: options, 
  completionHandler: { optionIndex in
                    switch optionIndex {
                    case 0:
                        print("Option 1 selected")
                    case 1:
                        print("Option 2 selected")
                    case 2:
                        print("Option 3 selected")
                    default:
                        break
                    }
                })

Be sure to check out the demo code for better understanding of the usage.

As for Objective-C integration, a slightly different static function should be used, in which the menuOptions array is expected to be an NSArray of NSDictionary's. Please check the snippet below:


    NSArray *options = @[@{@"Option 1": @(PeekViewActionStyleDefault)},
                         @{@"Option 2": @(PeekViewActionStyleDestructive)}];
    
    UIViewController *contentViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"previewVC"];
    
    [PeekView viewForControllerWithParentViewController:self
                                  contentViewController:contentViewController
                               expectedContentViewFrame:CGRectMake(0, 0, 280, 400)
                                            fromGesture:gesture
                                    shouldHideStatusBar:YES
                                            withOptions:options
                                      completionHandler:nil];

ARC

PeekView uses ARC. If you are using PeekView in a non-arc project, you will need to set a -fobjc-arc compiler flag on every PeekView source files. To set a compiler flag in Xcode, go to your active target and select the "Build Phases" tab. Then select PeekView source files, press Enter, insert -fobjc-arc and then "Done" to enable ARC for PeekView.

Contributing

Contributions for bug fixing or improvements are welcome. Feel free to submit a pull request.

Author: itsmeichigo
Source Code: https://github.com/itsmeichigo/PeekView
License: MIT license

#ios #swift 

iOS App Development Company in Singapore

iOS app development in Singapore

iOS has become the first priority for most smartphone users because of the security it offers compares to the Android operating system. Due to this reason, it is suggested to launch an app in iOS before other platforms.

Want to develop an iOS app in Singapore?

WebClues Infotech with its worldwide reach has already offered its iOS app development services to customers in Singapore. With a highly-skilled development team of 120+ members, WebClues Infotech has got the required resources an agency needs to fulfil client requirements around the world.

Want to know more about our iOS app development services in Singapore?

Visit: https://www.webcluesinfotech.com/iphone-app-development/

Share your requirements https://www.webcluesinfotech.com/contact-us/

View Portfolio https://www.webcluesinfotech.com/portfolio/

#ios app development in singapore #ios app development company #ios app development #ios #ios app #hire ios developer

iOS App Development in the United Arab Emirates

iOS App Development in the United Arab Emirates

Developed and Developing nations have seen a rapid rise in the demand for iOS app development and the United Arab Emirates is no exception. The use of on-demand apps has increased drastically in the last decade and business is leveraging this demand with launching iOS mobile apps.

Want to develop the iOS app in the United Arab Emirates?

WebClues Infotech after serving multiple clients in UAE has become well aware of the people’s needs in the region. With a highly experienced development team that has completed more than 950+ projects, we are prepared to serve you with your iOS app development needs.

Want to know more about our iOS App Development Services in UAE?

Visit: https://www.webcluesinfotech.com/iphone-app-development/

Share your requirements https://www.webcluesinfotech.com/contact-us/

View Portfolio https://www.webcluesinfotech.com/portfolio/

#ios app development in the united arab emirates #ios app development #ios app #ios #ios app development company #hire ios developer

iOS App Development Company in India

iOS app development company in India

India is considered the IT hub of the world because of n number of IT infrastructure development services offering companies. In this whole market iOS app development is the leading service offered by agencies across India

Want to develop the iOS app in India

WebClues Infotech with its head office in India has created a huge presence across the world over time and has served clients in all of the major countries around the world. WebClues Infotech with a highly skilled development team of 120+ members can help you deliver a better result at a reasonable cost.

Want to know more about our iOS app development services in India?

Visit: https://www.webcluesinfotech.com/iphone-app-development/

Share your requirements https://www.webcluesinfotech.com/contact-us/

View Portfolio https://www.webcluesinfotech.com/portfolio/

#ios app development company in india #ios app development company #ios app development #ios app #ios #hire ios app developer

iOS App Development Agency in the USA

iOS App Development Agency in the USA

Whenever a start-up in the USA launch an MVP version of the app they prefer to launch it only for iPhone user because the US has a large market of iPhone users in comparison to Android. The recent phenomenon of Clubhouse is the biggest example.

Want to develop an iOS app in the USA?

With 2 office locations across the USA and 6 worldwide, WebClues Infotech has the experience of serving a huge client base of 600+. After such a satisfied client base, WebClues Infotech is prepared to serve you with and iOS App Development Services in the USA.

Want to know more about our iOS App Development Services in the USA?

Visit: https://www.webcluesinfotech.com/iphone-app-development/

Share your requirements https://www.webcluesinfotech.com/contact-us/

View Portfolio https://www.webcluesinfotech.com/portfolio/

#ios app development agency in the usa #ios app development agency #ios app development #ios app #ios #hire ios app developer