-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from JonasGessner/master
2.0 Stable Release
- Loading branch information
Showing
95 changed files
with
2,943 additions
and
1,774 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,5 @@ xcuserdata | |
profile | ||
*.moved-aside | ||
DerivedData | ||
.idea/ | ||
.idea/ | ||
Mockup.pxm |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// | ||
// AppDelegate.swift | ||
// JGProgressHUD-Tests-Swift | ||
// | ||
// Created by Jonas Gessner on 25.09.17. | ||
// Copyright © 2017 Jonas Gessner. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
@UIApplicationMain | ||
class AppDelegate: UIResponder, UIApplicationDelegate { | ||
|
||
var window: UIWindow? | ||
|
||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | ||
window = UIWindow(frame: UIScreen.main.bounds) | ||
window?.rootViewController = ViewController() | ||
window?.makeKeyAndVisible() | ||
// Override point for customization after application launch. | ||
return true | ||
} | ||
|
||
func applicationWillResignActive(_ application: UIApplication) { | ||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. | ||
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. | ||
} | ||
|
||
func applicationDidEnterBackground(_ application: UIApplication) { | ||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. | ||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. | ||
} | ||
|
||
func applicationWillEnterForeground(_ application: UIApplication) { | ||
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. | ||
} | ||
|
||
func applicationDidBecomeActive(_ application: UIApplication) { | ||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. | ||
} | ||
|
||
func applicationWillTerminate(_ application: UIApplication) { | ||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. | ||
} | ||
|
||
|
||
} | ||
|
93 changes: 93 additions & 0 deletions
93
Examples/JGProgressHUD-Tests-Swift/Assets.xcassets/AppIcon.appiconset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "20x20", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "20x20", | ||
"scale" : "3x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "29x29", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "29x29", | ||
"scale" : "3x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "40x40", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "40x40", | ||
"scale" : "3x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "60x60", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "60x60", | ||
"scale" : "3x" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"size" : "20x20", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"size" : "20x20", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"size" : "29x29", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"size" : "29x29", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"size" : "40x40", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"size" : "40x40", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"size" : "76x76", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"size" : "76x76", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "ipad", | ||
"size" : "83.5x83.5", | ||
"scale" : "2x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
Examples/JGProgressHUD-Tests-Swift/Base.lproj/LaunchScreen.storyboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13196" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> | ||
<device id="retina4_7" orientation="portrait"> | ||
<adaptation id="fullscreen"/> | ||
</device> | ||
<dependencies> | ||
<deployment identifier="iOS"/> | ||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/> | ||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
</dependencies> | ||
<scenes> | ||
<!--View Controller--> | ||
<scene sceneID="EHf-IW-A2E"> | ||
<objects> | ||
<viewController id="01J-lp-oVM" sceneMemberID="viewController"> | ||
<layoutGuides> | ||
<viewControllerLayoutGuide type="top" id="W1h-2E-Bfj"/> | ||
<viewControllerLayoutGuide type="bottom" id="9X7-J4-ckO"/> | ||
</layoutGuides> | ||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> | ||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | ||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> | ||
</view> | ||
</viewController> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> | ||
</objects> | ||
<point key="canvasLocation" x="53" y="375"/> | ||
</scene> | ||
</scenes> | ||
</document> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>APPL</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
<key>LSRequiresIPhoneOS</key> | ||
<true/> | ||
<key>UILaunchStoryboardName</key> | ||
<string>LaunchScreen</string> | ||
<key>UIRequiredDeviceCapabilities</key> | ||
<array> | ||
<string>armv7</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
<key>UISupportedInterfaceOrientations~ipad</key> | ||
<array> | ||
<string>UIInterfaceOrientationPortrait</string> | ||
<string>UIInterfaceOrientationPortraitUpsideDown</string> | ||
<string>UIInterfaceOrientationLandscapeLeft</string> | ||
<string>UIInterfaceOrientationLandscapeRight</string> | ||
</array> | ||
</dict> | ||
</plist> |
136 changes: 136 additions & 0 deletions
136
Examples/JGProgressHUD-Tests-Swift/ViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
// | ||
// ViewController.swift | ||
// JGProgressHUD-Tests-Swift | ||
// | ||
// Created by Jonas Gessner on 25.09.17. | ||
// Copyright © 2017 Jonas Gessner. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import JGProgressHUD | ||
|
||
final class GradientView: UIView { | ||
init(startColor: UIColor, endColor: UIColor) { | ||
super.init(frame: .zero) | ||
|
||
gradientLayer.colors = [startColor.cgColor, endColor.cgColor] | ||
gradientLayer.startPoint = CGPoint(x: 0.5, y: 0) | ||
gradientLayer.endPoint = CGPoint(x: 0.5, y: 1) | ||
gradientLayer.locations = [0.0, 1.0] | ||
} | ||
|
||
@available(*, unavailable) | ||
required init?(coder aDecoder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
override class var layerClass: AnyClass { | ||
return CAGradientLayer.self | ||
} | ||
|
||
private var gradientLayer: CAGradientLayer { | ||
return layer as! CAGradientLayer | ||
} | ||
} | ||
|
||
extension UIColor { | ||
convenience init(rgb: UInt) { | ||
self.init( | ||
red: CGFloat((rgb & 0xFF0000) >> 16) / 255.0, | ||
green: CGFloat((rgb & 0x00FF00) >> 8) / 255.0, | ||
blue: CGFloat(rgb & 0x0000FF) / 255.0, | ||
alpha: 1.0 | ||
) | ||
} | ||
} | ||
|
||
final class ViewController: UIViewController { | ||
override var prefersStatusBarHidden: Bool { | ||
return true | ||
} | ||
|
||
override func loadView() { | ||
self.view = GradientView(startColor: UIColor(rgb: 0x24C6DC), endColor: UIColor(rgb: 0x514A9D)) | ||
} | ||
|
||
override func viewDidAppear(_ animated: Bool) { | ||
super.viewDidAppear(animated) | ||
|
||
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(1000)) { | ||
self.showPieHUD() | ||
} | ||
} | ||
|
||
func showSimpleHUD() { | ||
let hud = JGProgressHUD(style: .light) | ||
hud.vibrancyEnabled = true | ||
hud.textLabel.text = "Simple example in Swift" | ||
hud.detailTextLabel.text = "See JGProgressHUD-Tests for more examples" | ||
hud.shadow = JGProgressHUDShadow(color: .black, offset: .zero, radius: 5.0, opacity: 0.2) | ||
hud.show(in: self.view) | ||
} | ||
|
||
func showHUDWithTransform() { | ||
let hud = JGProgressHUD(style: .light) | ||
hud.vibrancyEnabled = true | ||
hud.textLabel.text = "Loading..." | ||
hud.layoutMargins = UIEdgeInsetsMake(0.0, 0.0, 10.0, 0.0) | ||
|
||
hud.show(in: self.view) | ||
|
||
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(1000)) { | ||
UIView.animate(withDuration: 0.3) { | ||
hud.indicatorView = nil | ||
hud.textLabel.font = UIFont.systemFont(ofSize: 30.0) | ||
hud.textLabel.text = "Done" | ||
hud.position = .bottomCenter | ||
} | ||
} | ||
|
||
hud.dismiss(afterDelay: 4.0) | ||
|
||
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(5)) { | ||
self.showSimpleHUD() | ||
} | ||
} | ||
|
||
func showPieHUD() { | ||
let hud = JGProgressHUD(style: .light) | ||
hud.vibrancyEnabled = true | ||
hud.indicatorView = JGProgressHUDPieIndicatorView() | ||
hud.detailTextLabel.text = "0% Complete" | ||
hud.textLabel.text = "Downloading..." | ||
hud.show(in: self.view) | ||
|
||
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(400)) { | ||
self.incrementHUD(hud, progress: 0) | ||
} | ||
} | ||
|
||
func incrementHUD(_ hud: JGProgressHUD, progress previousProgress: Int) { | ||
let progress = previousProgress + 1 | ||
hud.progress = Float(progress)/100.0 | ||
hud.detailTextLabel.text = "\(progress)% Complete" | ||
|
||
if progress == 100 { | ||
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(500)) { | ||
UIView.animate(withDuration: 0.1, animations: { | ||
hud.textLabel.text = "Success" | ||
hud.detailTextLabel.text = nil | ||
hud.indicatorView = JGProgressHUDSuccessIndicatorView() | ||
}) | ||
|
||
hud.dismiss(afterDelay: 1.0) | ||
|
||
DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(2)) { | ||
self.showHUDWithTransform() | ||
} | ||
} | ||
} | ||
else { | ||
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(20)) { | ||
self.incrementHUD(hud, progress: progress) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.