Swiftpack.co - doHernandezM/SlideViewController as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
SlideView Controller: A neat way to easily have 2-4 UIViewControllers share a view.
.package(url: "https://github.com/doHernandezM/SlideViewController.git", from: "v0.91")


drawing drawing drawing

Do you need to display multiple UIVIewControllers in a small space? Do their frames need to be user adjustable? That's what SlideViewController is for. Automatically displays up to four views depending on how many views it is sent. Can be configured with a horizontal or vertical orientation and to rotate clockwise or counter-clockwise. This swift UIViewController subclass requires iOS 13+ or macOS Catalyst 10.15+.

Slider Gestures:

  • PAN will move the slider around.
  • LONGPRESS will toggle edit mode on and off.
  • TAP during edit mode will rotate the views. Or you can set it to change the configuration(horizontal/vertical/top/bottom) by calling changeGridStyle.

As easy as creating the view then giving it some viewControllers

For example:

let subViewControllers = [zxyMapController, xyzFavesTableController, zxySettingController]
let slideController = SlideViewController(newViewControllers: subViewControllers) //Sets view position based in order (ie 0 = Primary, 1 = Secondary, etc.)

Funtionality options:

Many of these options are not meant to be called during runtime, but can be.

  • This struct passes configuration options to the SlideViewController.
struct SlideViewConfiguarationStruct {}
  • Color and Size options:
func setConfiguration(newConfiguration: SlideViewConfiguarationStruct?)

var backgroundColor:UIColor = .systemBackground
var crosshairColor:UIColor = .systemGray
var crosshairActiveColor:UIColor = .systemBlue
  • Inter-view border thickness. Unless you have another mechanism for moving the slider, anything less than 9 is hard to tap.
var slideViewBorderThickness = CGFloat(9)
  • Interface options:
var gridStyle:SlideViewPositions = .Primary
var rotateClockwise:Bool = true
var rotateViews:Bool = false
var stopEditAfterRotate:Bool = false//If a rotation event if fleeting, get out of it after one rotation.
var editModeActive:Bool = false//Edit mode can be set here, must update views after this is set.
var xyLock: (x:Bool,y:Bool) = (false,false)//Make it so the slider will only move in one direction.

Accessibility options:

  • SlideView calls out the slider location, but will not call out child view locations. Possible for future update.

To Fix:

  • Add accessibility Catalyst accessibility needs work/Slider's voiceover script needs to support internationalization, just english for now.
  • ~~When adding views, if you are in edit mode, new views do not get rounded corners.
  • Single view mode is currently stuck in the upper left hand corner.
  • Change "config" to primary view position and change SliderViewPosition to something else


Stars: 0
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

3 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics