All Projects → HarshilShah → Notchkit

HarshilShah / Notchkit

Licence: mit
A simple way to hide the notch on the iPhone X

Programming Languages

swift
15916 projects
ruby
36898 projects - #4 most used programming language
objective c
16641 projects - #2 most used programming language

Projects that are alternatives of or similar to Notchkit

FaceAvataaars
Puppeteer Avataaars with your iPhone X (and also test cartoons using BlendShapeRecorder data)
Stars: ✭ 19 (-98.96%)
Mutual labels:  iphone-x
Ios11
这里总结了大家iOS 11,iPhone X 适配问题.如有问题,欢迎大家讨论.
Stars: ✭ 640 (-65.03%)
Mutual labels:  iphone-x
Responsivedevices.css
Responsive CSS Device frames for your landing pages
Stars: ✭ 59 (-96.78%)
Mutual labels:  iphone-x
record3d unity demo
iPhone X -> Unity VFX Graph demo (real-time Point Cloud streaming)
Stars: ✭ 80 (-95.63%)
Mutual labels:  iphone-x
Instagram
A simple imitation of Instagram  app .
Stars: ✭ 346 (-81.09%)
Mutual labels:  iphone-x
Gravityslider
🔄 GravitySlider is a beautiful alternative to the standard UICollectionView flow layout.
Stars: ✭ 784 (-57.16%)
Mutual labels:  iphone-x
Swatch
Watcher for Unit Tests written in Swift
Stars: ✭ 55 (-96.99%)
Mutual labels:  iphone-x
Tkkeyboardcontrol
TKKeyboardControl adds keyboard awareness and scrolling dismissal (like iMessages app) to any view with only 1 line of code for Swift.
Stars: ✭ 110 (-93.99%)
Mutual labels:  iphone-x
Hairpowder
Hair Powder for iPhoneX "M" Shape pattern baldness design
Stars: ✭ 566 (-69.07%)
Mutual labels:  iphone-x
Evncustomsearchbar
🔍Born for iOS 11 and iPhone X SearchBar
Stars: ✭ 52 (-97.16%)
Mutual labels:  iphone-x
FacefARt
The world's most advanced fart app. Ever.
Stars: ✭ 13 (-99.29%)
Mutual labels:  iphone-x
Misterfusion
MisterFusion is Swift DSL for AutoLayout. It is the extremely clear, but concise syntax, in addition, can be used in both Swift and Objective-C. Support Safe Area and Size Class.
Stars: ✭ 314 (-82.84%)
Mutual labels:  iphone-x
Swift 30 Projects
30 mini Swift Apps for self-study
Stars: ✭ 6,972 (+280.98%)
Mutual labels:  iphone-x
ki-snackbar
An easy to use alternative of Android snackbar for iOS.
Stars: ✭ 12 (-99.34%)
Mutual labels:  iphone-x
Unityiphonexsupport
Support iPhoneX by changing the drawing area of Unity.
Stars: ✭ 59 (-96.78%)
Mutual labels:  iphone-x
NotchToolkit
Use the iPhone X notch in creative ways 👩‍🎨👨‍🎨.
Stars: ✭ 55 (-96.99%)
Mutual labels:  iphone-x
Swiftmessages
A very flexible message bar for iOS written in Swift.
Stars: ✭ 6,363 (+247.7%)
Mutual labels:  iphone-x
Flexlib
FlexLib是一个基于flexbox模型,使用xml文件进行界面布局的框架,融合了web快速布局的能力,让iOS界面开发像写网页一样简单快速
Stars: ✭ 1,569 (-14.26%)
Mutual labels:  iphone-x
Panels
Panels is a framework to easily add sliding panels to your application
Stars: ✭ 1,457 (-20.38%)
Mutual labels:  iphone-x
Sbsanimoji
🐵 Animoji app using Apples AvatarKit
Stars: ✭ 884 (-51.69%)
Mutual labels:  iphone-x

NotchKit

CI Status Version CocoaPods Carthage License Contact

NotchKit is a simple way to hide the notch on the iPhone X, and create a card-like interface for your apps. Inspired by this tweet from Sebastiaan de With:

I hope / wish that the 'iPhone 8' UI looks like this: using black OLED or wallpaper behind to make apps 'cards'. Would be beautiful. pic.twitter.com/mravS87NFy

— Sebastiaan de With (@sdw) August 31, 2017

Here's what it looks like:

Demo

Requirements

  • Swift 4
  • iOS 8

Installation

NotchKit is available via CocoaPods and Carthage

CocoaPods

To install NotchKit using CocoaPods, add the following line to your Podfile:

pod 'NotchKit'

Carthage

To install NotchKit using Carthage, add the following line to your Cartfile:

github "HarshilShah/NotchKit"

Usage

Integrating NotchKit is extremely simple. Firstly, import NotchKit in the file where your AppDelegate is stored.

Next, replace the didFinishLaunchingWithOptions method with the following, swapping in your custom view controller's class in place of ViewController

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    window = NotchKitWindow(frame: UIScreen.main.bounds)
    let rootViewController = ViewController()
    window?.rootViewController = rootViewController
    window?.makeKeyAndVisible()
    return true
}

If you use Storyboards, you can instantiate your Storyboard and fetch the new rootViewController in code using the following, swapping in your Storyboard's class for Main:

let storyboard = UIStoryboard(name: "Main", bundle: nil)
let rootViewController = storyboard.instantiateInitialViewController()

If you target a version of iOS earlier than iOS 11, you can still use NotchKit by loading the NotchKitWindow conditionally using the #available syntax, as follows:

window = {
    if #available(iOS 11, *) {
        return NotchKitWindow()
    } else {
        return UIWindow()
    }
}()

And that's all, you're done!

Customisation

There are some customisation points offered in NotchKit.

You can adjust these from any view or view controller belonging to the window, by simply calling the window as a NotchKitWindow, as follows:

(view.window as? NotchKitWindow)?.propertyToCustomise = valueYouWantToSet

Target Devices

By default, NotchKit hides the status bar and home indicator on all devices. However if you choose you can limit this behaviour to just the iPhone X and have it do nothing on other devices by setting the shouldShowBarsOnlyOniPhoneX property to true.

Masked Edges

By default, NotchKit masks all edges where applicable. You can customise this behaviour using the maskedEdges property, which accepts a UIRectEdge object that specifies the edges you want to mask.

Corner Radius

You can customise the corner radius of the window, via the .cornerRadius property. This property is an enum and can either be .standard, which does all the maths for you to show an appropriate corner radius, or you can set a custom value by setting it to .custom(n), where n is a custom corner radius of your choice.

Author

Written by Harshil Shah. You can find me on Twitter.

License

NotchKit is available under the MIT license. See the LICENSE file for more info.


P.S.: This was made mostly as a joke while I was debating different ways to handle the iPhone X.

Apple's updated Human Interface Guidelines for the iPhone X explicitly call this out:

Don't mask or call special attention to key display features. Don't attempt to hide the device's rounded corners, sensor housing, or indicator for accessing the Home screen by placing black bars at the top and bottom of the screen. Don't use visual adornments like brackets, bezels, shapes, or instructional text to call special attention to these areas either.

I'm not sure if violating the HIG is often used as grounds for a rejection, however I wouldn't bet either way.

It only took me a couple of days using the simulator to realise that embracing the notch is the way forward. My intention with open-sourcing this was to make it easier for others to reach that conclusion as well.

#EmbraceTheNotch

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].