Show the weather effects onto view written in Swift4.2

Overview

URWeatherView

Awesome Swift podplatform pod poddoc license CocoaPods compatible Carthage compatible FOSSA Status

What is this for?

Showing some kinds of the weather effect, written in Swift4.2.

This code style is the Protocol Oriented Programming.

To show the vector animation made by After Effect, Lottie can be used instead of UIImageView.

Before using URWeatherView, Which resources do you need?

1. main image or main lottie resource (Required)

  • The weather effect's main target
  • apply tone curve filter or gradient mask

2. backgroundImage of main (Optional)

  • The weather effect's background Image

3. upperImage of main (Optional)

  • The weather effect's upper Image
  • If you want extra effect, you can use it.

Usable Weather Effects

1. Snow

sample

2. Rain

sample

3. Dust

  • #1
    sample_dust1
  • #2
    sample_dust2

4. Lightning

sample_lightning

5. Hot

sample_hot

6. Cloudy

sample_cloudy

Used library stack

SpriteKit

CIFilter & CIKernel & Core Imager Kernel Language(like GLSL)

Lottie

  • I needed to apply color filter for the weather effect.
    So, I made custom Lottie library to get some properties from LOTAnimationView.
  • It's lottie-ios-extension.

Requirements

  • iOS 10.0+
  • Swift 4.2+ (Swift 3.x version is v0.6.4)

Installation

Cocoapods

Add the following to your Podfile.

pod "URWeatherView"

Dependency

lottie-ios-extension
(But, you don't need to care about this, when using URWeatherView. It's already included the dependency.)

Carthage

Add the following to your Cartfile.

github "jegumhon/URWeatherView"

Dependency

lottie-ios-extension
(But, you don't need to care about this, when using URWeatherView. It's already included the dependency.)

Examples

See the Example folder.
Run pod install and open the .xcworkspace.
(The Example source is made for using Carthage.
So, you remove the linked frameworks in General of the project settings.
And then, you remove the run script of Carthage in Build Phases of the project settings.)
or
Run carthage update and open the .xcodeproj.

Usage

import URWeatherView

1. initialize the weather view

    // for example...
        
    // You can use the xib or storyboard to show the URWeatheView...
    @IBOutlet var mainView: URWeatherView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        // set the main Image to apply the weather effects...
        // and set the backgroundImage, if you want to apply...
        self.mainView.initView(mainWeatherImage: #imageLiteral(resourceName: "buildings"), backgroundImage: #imageLiteral(resourceName: "bluesky.en"))
        
        // or, to use Lottie, do like below..
        // self.mainView.initView(dataNameOfLottie: "data", backgroundImage: #imageLiteral(resourceName: "bluesky.en"))
    }
1.1. How to use Lottie
  • You can find the detail Lottie usage guide at the Lottie-iOS
  • add the lottie files in the project, and then just use the json file name to load the Lottie View

2. show or remove the weather effects

    func showWeather() {
        let weather: URWeatherType = .cloudy
        self.mainView.startWeatherSceneBulk(weather, debugOption: true, additionalTask: {
            // task what you want to do after showing the weather effect...
        })
    }
    
    func removeWeather() {
        self.mainView.stop()
    }

3. πŸ˜€ Configurable parameters of URWeatherView πŸ˜€

Using or composing the functions in the URWeatherView, you can customize the weather effects. The default configurable parameters are like below.

  • birthRate : The particle's birth rate. This is used in the effects. e.g. Snow, Rain, Dust, Cloud.
  • upperImage : The image onto the weather view. (optional)
  • duration : The duration(in second). applied some effects among the URWeatherView's effects.
  • debugOption : enable to show the debug option of SpriteKit's. Default is "false". This is for the SpriteKit frame checking.
  • cloud effect's option : especially, you can customize the cloud effect with this structure. The sample codes is included in the example codes. Or you can see the codes below.
    case .cloudy:
    //    self.mainView.startWeatherSceneBulk(cell.weather, duration: 33.0, debugOption: self.segment.selectedSegmentIndex == 0)

        self.mainView.initWeather()
        self.mainView.setUpperImageEffect(customImage: nil)
        let option = UREffectCloudOption(CGRect(x: 0.0, y: 0.5, width: 1.0, height: 0.5), angleInDegree: 0.0, movingDuration: 33.0)
        self.mainView.startWeatherScene(cell.weather, duration: 33.0, userInfo: [URWeatherKeyCloudOption: option])

To-Do

  • exchange the Core Image Kernel to Metal.

License

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

FOSSA Status

You might also like...
🏞 A simple iOS photo and video browser with optional grid view, captions and selections written in Swift5.0
🏞 A simple iOS photo and video browser with optional grid view, captions and selections written in Swift5.0

Introduction 🏞 MediaBrowser can display one or more images or videos by providing either UIImage objects, PHAsset objects, or URLs to library assets,

πŸ” Awesome fully customize search view like Pinterest written in Swift 5.0 + Realm support!
πŸ” Awesome fully customize search view like Pinterest written in Swift 5.0 + Realm support!

YNSearch + Realm Support Updates See CHANGELOG for details Intoduction πŸ” Awesome search view, written in Swift 5.0, appears search view like Pinteres

πŸš€  Elegant Pager View fully written in pure SwiftUI.
πŸš€ Elegant Pager View fully written in pure SwiftUI.

PagerTabStripView Made with ❀️ by Xmartlabs team. XLPagerTabStrip for SwiftUI! Introduction PagerTabStripView is the first pager view built in pure Sw

An easy to use FAQ view for iOS written in Swift
An easy to use FAQ view for iOS written in Swift

FAQView An easy to use FAQ view for iOS written in Swift. This view is a subclass of UIView. Setup with CocoaPods If you are using CocoaPods add this

A custom stretchable header view for UIScrollView or any its subclasses with UIActivityIndicatorView and iPhone X safe area support for content reloading. Built for iOS 10 and later.

Arale A custom stretchable header view for UIScrollView or any its subclasses with UIActivityIndicatorView support for reloading your content. Built f

Play BreakOut while loading - A playable pull to refresh view using SpriteKit
Play BreakOut while loading - A playable pull to refresh view using SpriteKit

BreakOutToRefresh Play BreakOut while loading - A playable pull to refresh view using SpriteKit BreakOutToRefresh uses SpriteKit to add a playable min

A simple, customizable view for efficiently collecting country information in iOS apps.
A simple, customizable view for efficiently collecting country information in iOS apps.

CountryPickerView CountryPickerView is a simple, customizable view for selecting countries in iOS apps. You can clone/download the repository and run

Elissa displays a notification on top of a UITabBarItem or any UIView anchor view to reveal additional information.
Elissa displays a notification on top of a UITabBarItem or any UIView anchor view to reveal additional information.

Elissa Attach a local notification to any UIView to reveal additional user guidance. Usage Example Per default, Elissa will try to align to the center

A child view controller framework that makes setting up your parent controllers as easy as pie.
A child view controller framework that makes setting up your parent controllers as easy as pie.

Description Family is a child view controller framework that makes setting up your parent controllers as easy as pie. With a simple yet powerful publi

Comments
  • Add license scan report and status

    Add license scan report and status

    Your FOSSA integration was successful! Attached in this PR is a badge and license report to track scan status in your README.

    Below are docs for integrating FOSSA license checks into your CI:

    opened by fossabot 1
  • Getting crashed when Cloud and rain works together

    Getting crashed when Cloud and rain works together

    Hi,

    I tried to use cloud and rain together with full limit in the sample. After some time, the app got crashed. Memory increases from 19MB to 600+MB and CPU also increases from 10% to 100%.

    I think cloud object is not destroying as shown in attached screenshot.

    Please, how to handle it. Thanks in advance.

    img_1874

    opened by aaasifrz9 3
Owner
Urtaq
iOS(Swift & Objective-c) Developer interested in javascript & other new languages
Urtaq
A beautiful radar view to show nearby items (users, restaurants, ...) with ripple animation, fully customizable

HGRippleRadarView Example To run the example project, clone the repo, and run pod install from the Example directory first. This project is inspired b

Hamza Ghazouani 352 Dec 4, 2022
Show progress in your app's Dock icon

DockProgress Show progress in your app's Dock icon This package is used in production by the Gifski app. You might also like some of my other apps. Re

Sindre Sorhus 958 Jan 2, 2023
A UINavigationController subclass that support pop interactive UINavigationbar with hidden or show.

KDInteractiveNavigationController Features ✨ UINavigationController interactive with UINavigationBar hidden or show Hide all UINavigationController ba

Kingiol 154 Dec 3, 2022
☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting

Features β€’ Guides β€’ Installation β€’ Usage β€’ Miscellaneous β€’ Contributing ?? README is available in other languages: ???? . ???? . ???? . ???? . ???? To

Juanpe CatalΓ‘n 11.7k Jan 6, 2023
Fetch the star wars api from all the planets and list and show details using Swift UI and Combine

Star Wars Planets Fetch the star wars planet data by using stat war api, list and show details using SwiftUI and Combine frameworks ?? Swift UI Framew

null 1 Aug 10, 2022
ToastSwiftUI-master - A simple way to show a toast or a popup in SwiftUI

ToastSwiftUI-master - A simple way to show a toast or a popup in SwiftUI

Kushal Shingote 2 May 25, 2022
A way to quickly add a notification badge icon to any view. Make any view of a full-fledged animated notification center.

BadgeHub A way to quickly add a notification badge icon to any view. Demo/Example For demo: $ pod try BadgeHub To run the example project, clone the r

Jogendra 772 Dec 28, 2022
Confetti View lets you create a magnificent confetti view in your app

ConfettiView Confetti View lets you create a magnificent confetti view in your app. This was inspired by House Party app's login screen. Written in Sw

Or Ron 234 Nov 22, 2022
Cool Animated music indicator view written in Swift

Cool Animated music indicator view written in Swift. ESTMusicIndicator is an implementation of NAKPlaybackIndicatorView in Swift for iOS 8. ζœ¬δΊΊθ‘—δ½œηš„δΉ¦η±γ€ŠLa

Aufree 465 Nov 28, 2022
An easy to use FAQ view for iOS written in Swift

FAQView An easy to use FAQ view for iOS written in Swift. This view is a subclass of UIView. Setup with CocoaPods If you are using CocoaPods add this

Mukesh Thawani 467 Dec 5, 2022