Snow globe framework is delightful / slightly cheese easter egg for christmas season. Turns your awesome app into a snow globe, when user shake the device.

Overview

SnowGlobe.framework

SnowGlobe.framework its easy to use, open source iOS framework written in swift. It allows you to ad delightful / cheesy Christmas easter egg to your awesome app for holiday season. When user shakes the device, your app “turns into a snow globe”. Leveraging CAEmitterLayer to create snow fall, snow globe like animation while device is shaken. I am a sucker for that kinda of thing. I don’t see anything wrong with falling for spirit of the holiday season and getting bit cheesy.

For more info and better formated docs head over to here.
If you have any questions / sugestion feel free to tweet at me @stringcode.

Installation

SnowGlobe is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "SnowGlobe"

###How to build and run sample project without CocoaPods

Download source form repo. To build and run it on device open Sample.xcworkspace. This workspace contains three projects. SnowGlobe framework project, Swift and Objective-C sample projects. Select either SwiftSample or ObjCSample schema. You’ll have to set up code signing to run on the device. Select either Swift/ObjCSample target and choose your team. Sample app demonstrates three ways you can use SnowGlobeView. My original use case was to ad SnowGlobeView as subview of application’s keyWindow. That way when user shakes the device, snow layer is over any ViewController’s view. For more detail check out about implementation section.

###How to add to your project

  1. Copy SnowGlobe folder to YourAwesomeApp project folder.
  2. Drag and drop SnowGlobe.xcodeproj file to your project. I usually create frameworks folder to keep things tidy, but its not necessary
  3. Select your app’s target and click on plus icon to add embedded binary.
  4. Select SnowGlobe.framework screenshot
  5. Add following code to your AppDelegate.swift or Obj-C equivalent :
import UIKit
import SnowGlobe

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?
    var snowGlobeView: SnowGlobeView?
    
    func applicationDidBecomeActive(application: UIApplication) {
        if snowGlobeView == nil {
            let bounds = application.keyWindow?.bounds
            snowGlobeView = SnowGlobeView(frame: bounds!)
            snowGlobeView?.shakeToSnow = true
            application.keyWindow?.addSubview(snowGlobeView!)
        }
    }
}

Build, Run & Shake it!

###About implementation The CAEmitterLayer class provides a particle emitter system for Core Animation. The particles are defined by instances of CAEmitterCell. SnowGlobeView overrides UIView’s layerClass method and returns CAEmitterLayer so that UIView becomes backed by CAEmitterLayer rather then CALayer. CAEmitterLayer needs array of CAEmitterCells. Single CAEmitterCell array with contents set to snowFlakeImage.CGImage will suffice. There plenty of properties with ranges to be set on them. For example there is size and sizeRange. Value of size will be random value size +- range. Using these properties with ranges allows us to create convincing dynamic snow storm effect.

You can simply add SnowGlobeView as subview of any view and it will start animating particles upon moving to window. However the use case SnowGlobeView was made for is to add it as subView of UIApplication’s keyWindow and set shakeToSnow property to true. This will create CMMotionManager witch monitors accelerometer and will animate snow fall briefly when threshold is met. Since SnowGlobeView is added as subview of key window you will get snow effect over entire UIViewController hierarchy.

There is lighterSnowMode property, if set to yes snow fall become not as dense.

There are two class methods lightSnowFlakeImage and darkSnowFlakeImage witch provide default snow flake images. You can also set your custom image. Recommended size is 74 X 74 pixels @2x.

You might also like...
A colored alert view for your iOS.
A colored alert view for your iOS.

日本語 KRAlertController KRAlertController is a beautiful and easy-to-use alert controller for your iOS written by Swift. Requirements iOS 10.0+ Xcode 10

SwiftEntryKit is a presentation library for iOS. It can be used to easily display overlays within your iOS apps.
SwiftEntryKit is a presentation library for iOS. It can be used to easily display overlays within your iOS apps.

SwiftEntryKit 🤗 Donations can be made here. Table of Contents Overview Features Example Project Example Project Installation Presets Playground Requi

Zingle – An alert will display underneath your UINavigationBar 🎅
Zingle – An alert will display underneath your UINavigationBar 🎅

Zingle Zingle – An alert will display underneath your UINavigationBar 🎅 💥 Note: Zingle has a dependency to have a UINavigationController in your app

BottomSheet makes it easy to add custom bottom sheets to your SwiftUI apps.
BottomSheet makes it easy to add custom bottom sheets to your SwiftUI apps.

BottomSheet About BottomSheet BottomSheet makes it easy to add custom bottom sheets to your SwiftUI apps. The result can look like this...or completel

A modern iOS toast view that can fit your notification needs
A modern iOS toast view that can fit your notification needs

CRToast CRToast is a library that allows you to easily create notifications that appear on top of or by pushing out the status bar or navigation bar.

Action sheet allows including your custom views and buttons.
Action sheet allows including your custom views and buttons.

CustomizableActionSheet Action sheet allows including your custom views and buttons. Installation CocoaPods Edit your Podfile: pod 'CustomizableAction

A simple and attractive AlertView to ask permission to your users for Push Notification.
A simple and attractive AlertView to ask permission to your users for Push Notification.

A simple and attractive AlertView **to ask permission to your users for Push Notification.** PRESENTATION Ask permission to user for push notification

The easiest way to display highly customizable in app notification banners in iOS
The easiest way to display highly customizable in app notification banners in iOS

Written in Swift 5 NotificationBanner is an extremely customizable and lightweight library that makes the task of displaying in app notification banne

📑 Actionsheet with navigation features such as the Flipboard App
📑 Actionsheet with navigation features such as the Flipboard App

📑 SHEET helps you easily create a wide variety of action sheets with navigation features used in the Flipboard App Installation CocoaPods pod 'Sheet'

Comments
  • Snow not showing

    Snow not showing

    I have the exact code, but the snow isn't showing. I know it's being created though. I can't hear sounds either, but if I add prints I see the function being called.

    opened by MoonheadApps 1
  • Swift 3 support

    Swift 3 support

    Hey! Thanks for this framework — the feature is great fun for our users during holiday season. :) That said, we can't get through holiday season without getting through Swift 3 Migration Season, so I've updated this project for Swift 3 compatibility.

    I've also moved the podspec to the repo's root — it seemed to be the only way to get this library to work when pointing a project to it using a GitHub repository URL in a Podfile.

    Thanks — and lemme know if you have any questions.

    opened by kreeger 1
Owner
stringcode
stringcode
Awesome iOS 11 appstore cards in swift 5.

Cards brings to Xcode the card views seen in the new iOS XI Appstore. Getting Started Storyboard Go to main.storyboard and add a blank UIView Open the

Paolo Cuscela 4.1k Dec 14, 2022
AlertView A pop-up framework, Can be simple and convenient to join your project.

RAlertView AlertView A pop-up framework, Can be simple and convenient to join your project. Warning content Installation Depend on the project Masonry

杜耀辉 71 Aug 12, 2022
CoffeeToast - A swift package to easily add Toast notifications to your app

CoffeeToast A simple Swift package to add Toast Notifications to your app. Insta

Maegan Wilson 2 Feb 3, 2022
A customizable framework to create draggable views

CFNotify CFNotify is written in Swift. Using UIKit Dynamics as animator. It can make ANY UIView object draggable and throwable. This library mainly us

Johnny Tsoi 491 Nov 20, 2022
🍞 Loaf is a Swifty Framework for Easy iOS Toasts

Loaf ?? Inspired by Android's Toast, Loaf is a Swifty Framework for Easy iOS Toasts Usage From any view controller, a Loaf can be presented by calling

Mat Schmid 995 Dec 28, 2022
Bursts 🔥 A Funny Framework is showing alerts, Have been Adapting Swift and SwiftUI

Bursts ?? A Funny Framework is showing alerts, Have been Adapting Swift and SwiftUI Features iOS 10+ Can be used in UIKit and SwiftUI applications Lig

Jovins 11 Apr 22, 2022
A customizable, full-feature, lightweight iOS framework to be used instead of UIAlertController.

A customizable, full-feature, lightweight iOS framework to be used instead of UIAlertController.

Ali Samaiee 11 Jun 6, 2022
A customizable framework to create draggable views

CFNotify CFNotify is written in Swift. Using UIKit Dynamics as animator. It can make ANY UIView object draggable and throwable. This library mainly us

Johnny Tsoi 491 Nov 20, 2022
OEANotification is a customizable notification view framework

OEANotification OEANotification is an iOS library which provides to create notifications and customize them easily. You can create notifications with

Ömer Aslan 19 Jan 30, 2021
NiceAlertView is a Swift framework that can increase time of development and show nice custom AlertsViews

NiceAlertView Nice and beautiful AlertView for your iOS project NiceAlertView is a Swift framework that can increase time of development and show nice

Daniel Beltrami 0 Nov 24, 2021