UIWindow subclass to enable behavior like adaptive round-corners & detecting when Control Center is opened.

Overview

[Deprecated] AAWindow

This UIWindow-subclass is a collection of features that are intended to further polish the apps that we use daily. For now I've included two features that I haven't seen before and I thought might be interesting for a lot of people: Adaptive App cornerRadius & detecting when the user opens Control Center (to provide assistance for example when setting up AirPlay). I've been using it in almost all of my projects for university and will update it constantly as I come across new features. UIWindow is often overlooked and still bears a lot of potential. Stay tuned.

Setup is very easy. Just copy AAWindow.swift into your project and get started.

##Features

  • Adaptive rounded corners for UIWindow.

    Rounded corners on application frames have been very popular in the early days of iOS because they give you a feeling of the screen disappearing and the app blending with the device (just like nowadays on Apple Watch). Since iOS 7 though, rounded corners seemed to disappear. There are however still a few (even big-name) projects that use rounded corners for their app's window, one of the more popular being "Hyperlapse" by Facebook/Instagram. Hyperlapse looks really great (especially because there's not much of a UI at all), but once you take it to the Multitasking Switcher it starts to collide with iOS. One can clearly see tiny artefacts on each corner of the app-preview that ruin the effect. If you define a corner-radius in AAWindow it automatically animates it to *.layer.cornerRadius = 0 once the app is in a inactive state and animates back once it's active again.

    You set your cornerRadius by setting up AAWindow and passing a value other than 0 for cornerRadius:

    var window: UIWindow? = {
          let window = AAWindow(frame: UIScreen.mainScreen().bounds, cornerRadius: 6)
          return window
          }()
    
  • Detecting when the user opens Control Center.

    Apple very deliberately chose not to expose to us designers and developers whether the user opened Notification Center, Control Center, the Multitasking Switcher or whatever else might cause an app to be inactive. When developing "Cousteau" (the project from which "AASecondaryScreen" originated) I wished there was a way I could assist the user in setting up AirPlay Mirroring, since this is a process that a lot of users still aren't familiar with. That's why I came up with a solution that is built into AAWindow, that triggers an NSNotification (applicationWillResignActiveWithControlCenter) once the user opens Control Center. You can subscribe to this notification and react to it for example when you want to assist the user in setting up AirPlay, AirDrop or anything else accesible through Control Center. But remember, with great power comes great responsibility, so you shouldn't use this to force your users into activating things they might very deliberately have turned off in the first place. Especially with AirPlay it can be used quite effectively though.

    This is automatically available once AAWindow is setup correctly in AppDelegate.swift:

    var window: UIWindow? = {
          let window = AAWindow(frame: UIScreen.mainScreen().bounds, cornerRadius: 0)
          return window
          }()
    

    You can then subscribe to two provided NSNotifications automatically coming with AAWindow by using one of the provided methods NSNotificationCenter.defaultCenter().addObsever* from anywhere in your application:

    • applicationWillResignActiveWithControlCenter will fire when the user opens Control Center.
    • applicationWillResignActiveWithoutControlCenter will fire whenever applicationWillResignActive is called (i.e. the user opening Notification Center, …) except when the user opens Control Center.

##Example Project The very simple example project hopefully demonstrates the gist of using "AAWindow" and is thoroughly commented. If you have any questions don't hesitate contacting me @aaronabentheuer.

screencast

##License Released under the MIT License. Copyright © 2015 Aaron Abentheuer.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You might also like...
A flexible container view featuring a solid background with rounded corners.
A flexible container view featuring a solid background with rounded corners.

A flexible container view featuring a solid background with rounded corners.

Library that holds multiple books loaded from json in a scroll view where each book can be tapped on, favorited, rated, and opened to read
Library that holds multiple books loaded from json in a scroll view where each book can be tapped on, favorited, rated, and opened to read

Library that holds multiple books loaded from json in a scroll view where each book can be tapped on, favorited, rated, and opened to read. If a book is a favorite, an orange star appears on the book's cover. Page number, favorites, and ratings are saved for each session of the app.

365-day-of-code - This repository has been opened for 365 days to code iOS with Swift

365 day of code This repository has been opened for 365 days to code iOS with Sw

iOS 11 Control Center Slider
iOS 11 Control Center Slider

SectionedSlider Control Center Slider Requirements Installation Usage License Requirements iOS 8.0+ Swift 3.0+ Xcode 8.0+ Installation CocoaPods Cocoa

AdaptivePlus is the control center for marketing campaigns in mobile applications.

AdaptivePlus iOS SDK Introduction AdaptivePlus is the control center for marketing campaigns in mobile applications. Requirements iOS 11.0 or later Xc

This is an iOS Tweak that modifies the brightness slider in the Control Center.
This is an iOS Tweak that modifies the brightness slider in the Control Center.

AdvancedBrightnessSlider Tweak This is an iOS Tweak that modifies the brightness slider in the Control Center. Even with dark mode toggled on, I found

iOS 11 Control Center Slider
iOS 11 Control Center Slider

SectionedSlider Control Center Slider Requirements Installation Usage License Requirements iOS 8.0+ Swift 3.0+ Xcode 8.0+ Installation CocoaPods Cocoa

Alignment Control is a component to align top, middle, bottom, left, center, right.
Alignment Control is a component to align top, middle, bottom, left, center, right.

AlignmentControl is a component for alignment Direction AlignmentDirection Horizontal Vertical Mode AlignmentMode Left Center Right Top Middle Bottom

Codable, but with Super power made custom Codable behavior easy.

Codable, but with Super power made custom Codable behavior easy.

Reusable iOS's behavior drag or swipe to pop ViewController
Reusable iOS's behavior drag or swipe to pop ViewController

DLSwipeToPopController Reusable iOS's behavior to pop ViewController base on SwipeRightToPopController: Swipe from Right to Left to pop ViewController

A custom paging behavior that peeks the previous and next items in a collection view
A custom paging behavior that peeks the previous and next items in a collection view

MSPeekCollectionViewDelegateImplementation Version 3.0.0 is here! 🎉 The peeking logic is now done using a custom UICollectionViewLayout which makes i

Getting square objects down round holes

Enough with the bazillion lines of array parsing logic. YOLO. @import YOLOKit; campaigns.reject(^(PPCampaign *campaign){ return campaign.locked;

Simple app install/update behavior detection.

App-Update-Tracker AppUpdateTracker is a simple, lightweight iOS library intended to determine basic app install/update behavior. The following is a l

A custom calculator for deg to rad conversion & the other way round
A custom calculator for deg to rad conversion & the other way round

Lilium Features A custom calculator for deg to rad conversion & the other way round. How to use Slide up the dock and you should see Lilium. An activa

TestKit has been upgraded to a full solution for implementing Behavior-Driven Development (BDD) in Swift iOS apps.

The easiest way to implement full BDD in your Swift iOS projects! Use plain English specs (Gherkin) to drive tests that include both UI automation and interacting with application data & state.

Enable autocomplete use resources in swift project.

ResourceKit Enable autocomplete use resources in swift project. まだハードコードで消耗してるの? ResourceKitで安全コーディング! How does ResourceKit work? ResouceKit makes you

A UINavigationController's category to enable fullscreen pop gesture with iOS7+ system style.
A UINavigationController's category to enable fullscreen pop gesture with iOS7+ system style.

FDFullscreenPopGesture An UINavigationController's category to enable fullscreen pop gesture in an iOS7+ system style with AOP. Overview 这个扩展来自 @J_雨 同

Proxitee iOS SDK to enable iOS apps to use the Proxitee platform with iBeacon and GeoFencing

Proxitee iOS SDK Introduction The Proxitee iOS SDK allows you to enable your iOS devices to use the Proxitee platform with iBeacons and GeoFences, for

Tourist App enable users to search about touristic places in saudi arabia

TouristApp Project Name: Tourist Project Description : Tourist it's App enable users to search about touristic places in saudi arabia . Features List:

Comments
  • Fix broken headings in Markdown files

    Fix broken headings in Markdown files

    GitHub changed the way Markdown headings are parsed, so this change fixes it.

    See bryant1410/readmesfix for more information.

    Tackles bryant1410/readmesfix#1

    opened by bryant1410 0
  • Issue when starting app in landscape mode

    Issue when starting app in landscape mode

    This seems like a nice little feature. However it doesn't work well when started in landscape mode. The screen bounds are always sent as portrait, so AAWindow is init with wrong size and the touch gesture isn't calculated correctly. I tested it using your example project, iPad simulator and device.

    opened by ashavit 4
Owner
Aaron Abentheuer
intelligent augmentation
Aaron Abentheuer
Parse JSON like a badass

Parse JSON like a badass Full disclaimer regarding performance For production apps (or if you care about efficiency at all), I highly recommend using

Mike Rapadas 52 Nov 16, 2022
Easily add drop shadows, borders, and round corners to a UIView.

Easily add drop shadows, borders, rounded corners to a UIView. Installation CocoaPods Add the follwing to your Podfile: pod 'Shades' Usage Storyboard

Aaron Sutton 14 Jun 20, 2020
A package to help track how often the user opened the app and if they opened it in the current version before.

AppOpenTracker AppOpenTracker provides an observable AppOpenTracker.shared instance that can be used to track the last version that the app was opened

Florian Schweizer 9 Oct 29, 2022
A high-performance button control with rounded corners for iOS.

TORoundedButton TORoundedButton is an open source UI control of a standard user button. Its design consists of displaying text on top of a solid recta

Tim Oliver 480 Dec 26, 2022
RCalendarPicker A date picker control, Calendar calendar control, select control, calendar, date selection, the clock selection control.

RCalendarPicker RCalendarPicker Calendar calendar control, select control, calendar, date selection, the clock selection control. 日历控件 ,日历选择控件,日历,日期选择

杜耀辉 131 Jul 18, 2022
VolumeControl is a custom volume control for iPhone featuring a well-designed round slider.

#VolumeControl VolumeControl is a custom volume control for iPhone featuring a well-designed round slider. Preview Usage // Include VolumeControl.h in

12Rockets 81 Oct 11, 2022
round icon drag control (made in swift) dock style

ASBubbleDrag Bubble drag control integrate in storyboard : Installation CocoaPods You can use CocoaPods to install ASBubbleDrag by adding it to your P

Alberto Scampini 46 Oct 12, 2022
An adaptive scrollable graph view for iOS to visualise simple discrete datasets. Written in Swift.

ScrollableGraphView Announcements 9-7-2017 - Version 4: Version 4 was released which adds multiple plots, dynamic reloading of values, more reference

Phillip 5.3k Jan 5, 2023
PopupWindow is a simple Popup using another UIWindow in Swift

PopupWindow PopupWindow is a simple Popup using another UIWindow Feature PopupWindow can be displayed at the top or bottom of the screen. Popup can se

shinji hayashi 415 Dec 5, 2022
Automaticly display Log,Crash,Network,ANR,Leak,CPU,RAM,FPS,NetFlow,Folder and etc with one line of code based on Swift. Just like God opened his eyes

GodEye Automaticly display Log,Crash,Network,ANR,Leak,CPU,RAM,FPS,NetFlow,Folder and etc with one line of code based on Swift. Just like God opened hi

陈奕龙(子循) 3.7k Dec 23, 2022