FlickToDismiss
A basic UIViewController class that presents a UIView which can be dismissed by flicking it off the screen.
Install / Use
/learn @jakelawson1/FlickToDismissREADME
FlickToDismiss

Requirements
- iOS 8.0+
- Xcode 7.3
Installation
CocoaPods
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
To integrate FlickToDismiss into your Xcode project using CocoaPods, specify it in your Podfile:
pod 'FlickToDismiss', '~> 0.9'
Then, run the following command:
$ pod install
Manual
Add FlickToDismissViewController.swift to your project in Xcode.
Usage
Interface Builder
- Drag a new
UIViewControllerobject onto your storyboard. - Set the class to
FlickToDismissViewController. - Drag a
UIViewobject onto the View Controller. - Add any necessary constraints.
- Connect the
flickableViewoutlet to theUIViewin the Connections inspector. - Job done.
Programatically
let viewToFlick = UIView(frame: CGRect(x: 0, y: 0, width: 280, height: 300))
viewToFlick.backgroundColor = .whiteColor()
// Optional - See FlickToDismissOption for available options.
let options: [FlickToDismissOption] = [
.Animation(.Scale),
.BackgroundColor(UIColor(white: 0.0, alpha: 0.8))
]
let vc = FlickToDismissViewController(flickableView: viewToFlick, options: options)
vc.modalTransitionStyle = .CrossDissolve
vc.modalPresentationStyle = .OverFullScreen
presentViewController(vc, animated: true, completion: nil)
Hint - Subclassing UIView
Since Auto Layout sizes views according to their frames, it incorrectly assumes it has a larger space to lay things out when a view is rotated. To correct this we need to supply the method alignmentRectForFrame() in the view subclass:
override func alignmentRectForFrame(frame: CGRect) -> CGRect {
return bounds
}
License
FlickToDismiss is licensed under the MIT License. See LICENSE for details.
Let me know if you use FlickToDismiss in your projects, I would love to know!
Related Skills
node-connect
352.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
352.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
352.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
