diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..83236d6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,68 @@ +# Adapted from https://github.com/github/gitignore/blob/master/Objective-C.gitignore + +# Finder +.DS_Store + +# Xcode +## Build generated +build/ +DerivedData/ + +## Various settings +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata/ + +## Other +*.moved-aside +*.xccheckout +*.xcscmblueprint + +## Obj-C/Swift specific +*.hmap +*.ipa +*.dSYM.zip +*.dSYM + +# CocoaPods +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control + +Pods/ + +# Add this line if you want to avoid checking in source code from the Xcode workspace +# *.xcworkspace + +# Carthage +# +# Add this line if you want to avoid checking in source code from Carthage dependencies. +# Carthage/Checkouts + +Carthage/Build + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://docs.fastlane.tools/best-practices/source-control/#source-control + +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots/**/*.png +fastlane/test_output + +# Code Injection +# +# After new code Injection tools there's a generated folder /iOSInjectionProject +# https://github.com/johnno1962/injectionforxcode + +iOSInjectionProject/ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView.xcodeproj/project.pbxproj b/AJParticlesLoadingView/AJParticlesLoadingView.xcodeproj/project.pbxproj index 993639f..7aece49 100644 --- a/AJParticlesLoadingView/AJParticlesLoadingView.xcodeproj/project.pbxproj +++ b/AJParticlesLoadingView/AJParticlesLoadingView.xcodeproj/project.pbxproj @@ -164,7 +164,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0830; - LastUpgradeCheck = 0830; + LastUpgradeCheck = 1000; TargetAttributes = { A9334EB51F518B2800445BBE = { CreatedOnToolsVersion = 8.3.2; @@ -264,15 +264,23 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -295,7 +303,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.3; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -314,15 +322,23 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DOCUMENTATION_COMMENTS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -339,7 +355,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 10.3; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; @@ -354,14 +370,14 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = AJParticlesLoadingView/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.ajparticlesloadingview; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = 1; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; }; @@ -372,14 +388,14 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; DEVELOPMENT_TEAM = ""; INFOPLIST_FILE = AJParticlesLoadingView/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 9.3; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.ajparticlesloadingview; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_VERSION = 3.0; - TARGETED_DEVICE_FAMILY = 1; + SWIFT_VERSION = 4.0; + TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; }; diff --git a/AJParticlesLoadingView/AJParticlesLoadingView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/AJParticlesLoadingView/AJParticlesLoadingView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/AJParticlesLoadingView/AJParticlesLoadingView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/AJParticlesLoadingView/AJParticlesLoadingView.swift b/AJParticlesLoadingView/AJParticlesLoadingView/AJParticlesLoadingView/AJParticlesLoadingView.swift index 8148774..e0dcae5 100644 --- a/AJParticlesLoadingView/AJParticlesLoadingView/AJParticlesLoadingView/AJParticlesLoadingView.swift +++ b/AJParticlesLoadingView/AJParticlesLoadingView/AJParticlesLoadingView/AJParticlesLoadingView.swift @@ -11,99 +11,95 @@ import SpriteKit class AJParticlesLoadingView: UIView { - // MARK: - Public Properties - // MARK: - - - public var duration = 2.0 - public var particlesSize: CGFloat = 5.0 - public var particlesSpeed : CGFloat = 80.0 - public var clockwiseRotation: Bool = false - public var particleImage = ParticleImage.spark - - public var emitterNode: SKEmitterNode? = nil { - didSet { - if let emitter = emitterNode { - scene.setEmitterNode(emitter) - } + // MARK: - Public Properties + // MARK: - + + public var duration = 2.0 + public var particlesSize: CGFloat = 5.0 + public var particlesSpeed : CGFloat = 80.0 + public var clockwiseRotation: Bool = false + public var particleImage = ParticleImage.spark + + public var emitterNode: SKEmitterNode? = nil { + didSet { + if let emitter = emitterNode { + scene.setEmitterNode(emitter) } } + } - public var particleEffect = ParticleEffect.snow { - didSet { - if let _ = scene { - do { - let emitter = try particleFileLoad.createEmitterNode(with: particleEffect, particleImgName: particleImage.rawValue) - scene.setEmitterNode(emitter) - } catch { - print("Could not find the particles file") - } - } else { - setAJParticlesLoadingView() + public var particleEffect = ParticleEffect.snow { + didSet { + if let _ = scene { + do { + let emitter = try particleFileLoad.createEmitterNode(with: particleEffect, particleImgName: particleImage.rawValue) + scene.setEmitterNode(emitter) + } catch { + print("Could not find the particles file") } } + // If scene isn't defined yet, scene will be defined later via + // setAJParticlesLoadingView() when self is added to a parent + // superview which willMove(...) will notice. } + } - // MARK: - Private Properties - // MARK: - - - private let particleFileLoad = ParticleFileLoader() - private var spriteKitView = SKView() - private var scene: ParticlesSprites! - - // MARK: - Initialization - // MARK: - - - override public init(frame: CGRect) { - super.init(frame: frame) - spriteKitView = SKView(frame: CGRect(x: 0, y: 0, width: frame.size.width, height: frame.size.height)) - spriteKitView.backgroundColor = UIColor.clear - setAJParticlesLoadingView() - } - - required public init?(coder aDecoder: NSCoder) { - super.init(coder: aDecoder) - spriteKitView = SKView(frame: CGRect(x: 0, y: 0, width: frame.size.width, height: frame.size.height)) - spriteKitView.backgroundColor = UIColor.clear - setAJParticlesLoadingView() - } - - func setAJParticlesLoadingView() { - do { - let emitter = try particleFileLoad.createEmitterNode(with: particleEffect, particleImgName:particleImage.rawValue) - scene = ParticlesSprites(size: frame.size, emitterNode: emitter) - spriteKitView.presentScene(scene) - addSubview(spriteKitView) - } catch { - print("Could not find the particles file") - } - } - - public override func startAnimating() { - scene.startAnimating() - } - - public override func stopAnimating() { - scene.stopAnimating() - } - - public override func isEmitting() -> Bool { - return scene.isEmitting() - } - - public override func willMove(toSuperview newSuperview: UIView?) { - scene.setAnimationPath() + // MARK: - Private Properties + // MARK: - + + private let particleFileLoad = ParticleFileLoader() + private var spriteKitView = SKView() + private var scene: ParticlesSprites! + + // MARK: - Initialization + // MARK: - + + override public init(frame: CGRect) { + super.init(frame: frame) + spriteKitView.backgroundColor = UIColor.clear + } + + required public init?(coder aDecoder: NSCoder) { + super.init(coder: aDecoder) + spriteKitView.backgroundColor = UIColor.clear + } + + override func willMove(toSuperview newSuperview: UIView?) { + // Will be called once. + super.willMove(toSuperview:newSuperview) + setAJParticlesLoadingView() + scene.setAnimationPath() + } + + func setAJParticlesLoadingView() { + do { + let emitter = try particleFileLoad.createEmitterNode(with: particleEffect, particleImgName:particleImage.rawValue) + scene = ParticlesSprites(size: frame.size, emitterNode: emitter) + spriteKitView.presentScene(scene) + addSubview(spriteKitView) + } catch { + print("Could not find the particles file") } + } + override func layoutSubviews() { + // May be called multiple times due to rotations. + super.layoutSubviews() + // bounds = "view’s location and size in its own coordinate system" + // https://developer.apple.com/documentation/uikit/uiview/1622580-bounds + // frame = spriteKitView’s "location and size in its superview’s coordinate system" + // https://developer.apple.com/documentation/uikit/uiview/1622621-frame + spriteKitView.frame = bounds + } } public extension UIView { public func addParticlesAnimation(with emitter: SKEmitterNode? = nil, effect: ParticleEffect? = nil , imgName : String? = nil) { - var spriteKitView = SKView() - spriteKitView = SKView(frame: CGRect(x: 0, y: 0, width: frame.size.width, height: frame.size.height)) + let spriteKitView = SKView() + spriteKitView.frame = bounds spriteKitView.backgroundColor = UIColor.clear - var scene: ParticlesSprites if let emitter = emitter { scene = ParticlesSprites(size: frame.size, emitterNode: emitter) @@ -151,3 +147,4 @@ public extension UIView { return false } } + diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/AJParticlesLoadingView/ParticlesType.swift b/AJParticlesLoadingView/AJParticlesLoadingView/AJParticlesLoadingView/ParticlesType.swift index c9fb06d..91037f8 100755 --- a/AJParticlesLoadingView/AJParticlesLoadingView/AJParticlesLoadingView/ParticlesType.swift +++ b/AJParticlesLoadingView/AJParticlesLoadingView/AJParticlesLoadingView/ParticlesType.swift @@ -9,7 +9,6 @@ import Foundation public enum ParticleEffect: String { - case fire = "Fire" case snow = "Snow" case rain = "Rain" @@ -18,10 +17,16 @@ public enum ParticleEffect: String { case fireflies = "Fireflies" case spark = "Spark" case smoke = "Smoke" + static func allEffects() -> [ParticleEffect] { + return [.fire, .snow, .rain, .magic, .bokeh, .fireflies, .spark, .smoke] + } + static func random() -> ParticleEffect { + var all = allEffects() + return all[Int(arc4random_uniform(UInt32(all.count)))] + } } public enum ParticleImage: String { - case sunflower = "sunflower" case balloon = "balloons" case star = "star" @@ -29,5 +34,12 @@ public enum ParticleImage: String { case bokeh = "bokeh" case spark = "spark" case party = "party" + static func allImages() -> [ParticleImage] { + return [.sunflower, .balloon, .star, .heart, .bokeh, .spark, .party] + } + static func random() -> ParticleImage { + var all = allImages() + return all[Int(arc4random_uniform(UInt32(all.count)))] + } } diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Contents.json b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Contents.json index 118c98f..0878f38 100644 --- a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,34 +1,154 @@ { "images" : [ { + "scale" : "1x", + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-40.png" + }, + { + "scale" : "2x", + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-40@2x.png" + }, + { + "scale" : "2x", + "size" : "60x60", "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" + "filename" : "Icon-60@2x.png" + }, + { + "scale" : "1x", + "size" : "72x72", + "idiom" : "ipad", + "filename" : "Icon-72.png" + }, + { + "scale" : "2x", + "size" : "72x72", + "idiom" : "ipad", + "filename" : "Icon-72@2x.png" + }, + { + "scale" : "1x", + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-76.png" }, { + "scale" : "2x", + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-76@2x.png" + }, + { + "scale" : "1x", + "size" : "50x50", + "idiom" : "ipad", + "filename" : "Icon-Small-50.png" + }, + { + "scale" : "2x", + "size" : "50x50", + "idiom" : "ipad", + "filename" : "Icon-Small-50@2x.png" + }, + { + "scale" : "1x", + "size" : "29x29", "idiom" : "iphone", + "filename" : "Icon-Small.png" + }, + { + "scale" : "2x", "size" : "29x29", - "scale" : "3x" + "idiom" : "iphone", + "filename" : "Icon-Small@2x.png" + }, + { + "scale" : "1x", + "size" : "57x57", + "idiom" : "iphone", + "filename" : "Icon.png" }, { + "scale" : "2x", + "size" : "57x57", "idiom" : "iphone", + "filename" : "Icon@2x.png" + }, + { + "scale" : "3x", + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-Small@3x.png" + }, + { + "scale" : "3x", "size" : "40x40", - "scale" : "2x" + "idiom" : "iphone", + "filename" : "Icon-40@3x.png" }, { + "scale" : "3x", + "size" : "60x60", "idiom" : "iphone", + "filename" : "Icon-60@3x.png" + }, + { + "scale" : "2x", "size" : "40x40", - "scale" : "3x" + "idiom" : "iphone", + "filename" : "Icon-40@2x.png" + }, + { + "scale" : "1x", + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-Small.png" }, { + "scale" : "2x", + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-Small@2x.png" + }, + { + "scale" : "2x", + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-83.5@2x.png" + }, + { + "scale" : "2x", + "size" : "20x20", "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" + "filename" : "NotificationIcon@2x.png" }, { + "scale" : "3x", + "size" : "20x20", "idiom" : "iphone", - "size" : "60x60", - "scale" : "3x" + "filename" : "NotificationIcon@3x.png" + }, + { + "scale" : "1x", + "size" : "20x20", + "idiom" : "ipad", + "filename" : "NotificationIcon~ipad.png" + }, + { + "scale" : "2x", + "size" : "20x20", + "idiom" : "ipad", + "filename" : "NotificationIcon~ipad@2x.png" + }, + { + "scale" : "1x", + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "ios-marketing.png" } ], "info" : { diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-40.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-40.png new file mode 100644 index 0000000..0f5d516 Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-40.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-40@2x.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-40@2x.png new file mode 100644 index 0000000..fa92e7f Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-40@2x.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-40@3x.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-40@3x.png new file mode 100644 index 0000000..6b128d1 Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-40@3x.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png new file mode 100644 index 0000000..6b128d1 Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png new file mode 100644 index 0000000..815e8b8 Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-72.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-72.png new file mode 100644 index 0000000..fcfdf53 Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-72.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-72@2x.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-72@2x.png new file mode 100644 index 0000000..f720939 Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-72@2x.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-76.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-76.png new file mode 100644 index 0000000..4ca763b Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-76.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png new file mode 100644 index 0000000..b7e005a Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-76@2x.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-83.5@2x.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-83.5@2x.png new file mode 100644 index 0000000..f740741 Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-83.5@2x.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-Small-50.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-Small-50.png new file mode 100644 index 0000000..2d44cc5 Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-Small-50.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-Small-50@2x.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-Small-50@2x.png new file mode 100644 index 0000000..fd8f849 Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-Small-50@2x.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-Small.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-Small.png new file mode 100644 index 0000000..c92565f Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-Small.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png new file mode 100644 index 0000000..50cdb7b Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-Small@2x.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png new file mode 100644 index 0000000..00994dc Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon-Small@3x.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon.png new file mode 100644 index 0000000..32e4b7c Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon@2x.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon@2x.png new file mode 100644 index 0000000..c4fd2ab Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/Icon@2x.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/NotificationIcon@2x.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/NotificationIcon@2x.png new file mode 100644 index 0000000..0f5d516 Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/NotificationIcon@2x.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/NotificationIcon@3x.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/NotificationIcon@3x.png new file mode 100644 index 0000000..fb2edf9 Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/NotificationIcon@3x.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/NotificationIcon~ipad.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/NotificationIcon~ipad.png new file mode 100644 index 0000000..f99aba9 Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/NotificationIcon~ipad.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/NotificationIcon~ipad@2x.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/NotificationIcon~ipad@2x.png new file mode 100644 index 0000000..0f5d516 Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/NotificationIcon~ipad@2x.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/ios-marketing.png b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/ios-marketing.png new file mode 100644 index 0000000..79d7ba3 Binary files /dev/null and b/AJParticlesLoadingView/AJParticlesLoadingView/Assets.xcassets/AppIcon.appiconset/ios-marketing.png differ diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Base.lproj/Main.storyboard b/AJParticlesLoadingView/AJParticlesLoadingView/Base.lproj/Main.storyboard index 12311de..3e1b5c6 100644 --- a/AJParticlesLoadingView/AJParticlesLoadingView/Base.lproj/Main.storyboard +++ b/AJParticlesLoadingView/AJParticlesLoadingView/Base.lproj/Main.storyboard @@ -1,64 +1,82 @@ - - + + - + - - - Futura-Medium - - - - + + - + - - + + + + + - - - - - - - - - + - - + + - - + - + + diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/Info.plist b/AJParticlesLoadingView/AJParticlesLoadingView/Info.plist index 93b96dc..38e98af 100644 --- a/AJParticlesLoadingView/AJParticlesLoadingView/Info.plist +++ b/AJParticlesLoadingView/AJParticlesLoadingView/Info.plist @@ -31,6 +31,8 @@ UISupportedInterfaceOrientations UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight diff --git a/AJParticlesLoadingView/AJParticlesLoadingView/ViewController.swift b/AJParticlesLoadingView/AJParticlesLoadingView/ViewController.swift index 4ebc720..eafd4da 100644 --- a/AJParticlesLoadingView/AJParticlesLoadingView/ViewController.swift +++ b/AJParticlesLoadingView/AJParticlesLoadingView/ViewController.swift @@ -14,7 +14,7 @@ class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() - /* For creating animation you can use any particle image with any particle effect + /* For creating animation you can use any particle image with any particle effect Few tested examples are : heart - bokeh , sunflower - magic , star - fire , party - snow , balloon - fireflies etc. */ @@ -26,32 +26,46 @@ class ViewController: UIViewController { // Set the duration for completing the animation around the border of a view objAJParticlesLoadingView.duration = 2.0 - + // Set the size of each particle images which are being used for loading particles objAJParticlesLoadingView.particlesSize = 8.0 // Set clockwiseRotation enabled or disabled objAJParticlesLoadingView.clockwiseRotation = false - + // Set the speed at which particles are being loaded inside a view objAJParticlesLoadingView.particlesSpeed = 70.0 - - } - - override func didReceiveMemoryWarning() { - super.didReceiveMemoryWarning() - } @IBAction func btnClicked(_ sender: UIButton) { sender.isSelected = !sender.isSelected if sender.isSelected { + // Set the Particle Image + objAJParticlesLoadingView.particleImage = ParticleImage.random() + // Set the Particle Effect Type + while true { + let particleEffect = ParticleEffect.random() + if ((particleEffect != ParticleEffect.bokeh) + && (particleEffect != ParticleEffect.fire) + && (particleEffect != ParticleEffect.spark)) { + // NOTE: bokeh, fire, spark seem less impressive, so reject + // these until we get a different effect good for demo. + objAJParticlesLoadingView.particleEffect = particleEffect + break + } + } + // Log choice to Xcode console. + print(objAJParticlesLoadingView.particleImage.rawValue + + " - " + objAJParticlesLoadingView.particleEffect.rawValue) + // Start animating objAJParticlesLoadingView.startAnimating() sender.setTitle("STOP", for: UIControlState()) + sender.layer.backgroundColor = UIColor.red.cgColor } else { objAJParticlesLoadingView.stopAnimating() sender.setTitle("START", for: UIControlState()) + sender.layer.backgroundColor = UIColor.green.cgColor } } diff --git a/README.md b/README.md index a0469af..c841369 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ )![GIF3](https://media.giphy.com/media/xUPJUKgv6mqT0mCEH6/giphy.gif)![GIF4](https://media.giphy.com/media/xTcf0ZhrrWWhHx2ICY/giphy.gif)![GIF5](https://media.giphy.com/media/3o7qiWgLkgqHaG7R16/giphy.gif)![GIF6](https://media.giphy.com/media/xTcf0XUC9IQrR0NiO4/giphy.gif) ## Requirements -iOS 9.0 and Swift 3 are required. +iOS 8.0 and Swift 4.0 are required. ## Installation 1. Just Drag and Drop AJParticlesLoadingView folder in your project.