Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update progress function #18

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Assets/progress-example.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions Example/.swiftformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# .swiftformat
# Created by Felix Mau (https://felix.hamburg)
#

#
# "Global" formatting options
#
# "Global" formatting options will be applied from the `SwiftConfigurationFiles` repository.
# See https://github.com/fxm90/SwiftConfigurationFiles for further details.
#

#
# File options
#
# Note: Excluded paths are relative to the SwiftFormat configuration file.
# Therefore we can't specify them in the configuration file from the `SwiftConfigurationFiles` repository.
#
--exclude Pods
67 changes: 4 additions & 63 deletions Example/.swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,85 +2,26 @@
# .swiftlint.yml
# Created by Felix Mau (https://felix.hamburg)
#
# Based on:
# - https://gist.github.com/tweetjay/1b7f00b6f312a5a2cf7b5676420b9b0c
# - https://github.com/brandenr/swiftlintconfig
#

opt_in_rules:
- anyobject_protocol # Prefer using `AnyObject` over class for class-only protocols.
- array_init # Prefer using `Array(seq)` over `seq.map { $0 }` to convert a sequence into an Array.
- block_based_kvo # Prefer the new block based KVO API with keypaths when using Swift 3.2 or later.
- closure_spacing # Closure expressions should have a single space inside each brace.
- contains_over_filter_count # Prefer `contains` over comparing `filter(where:).count` to 0.
- contains_over_filter_is_empty # Prefer `contains` over using `filter(where:).isEmpty`.
- contains_over_first_not_nil # Prefer `contains` over `first(where:) != nil` and `firstIndex(where:) != nil`.
- empty_collection_literal # Prefer checking `isEmpty` over comparing collection to an empty array or dictionary literal.
- empty_count # Prefer checking `isEmpty` over comparing count to zero.
- empty_parameters # Prefer `() ->` over `Void ->`.
- empty_string # Prefer checking `isEmpty` over comparing string to an empty string literal.
- empty_xctest_method # Empty XCTest method should be avoided.
- explicit_init # Explicitly calling .init() should be avoided.
- fatal_error_message # A fatalError call should have a message.
- file_header # Header comments should be consistent with project patterns.
- first_where # Prefer using `.first(where:)` over `.filter { }.first` in collections.
- for_where # `where` clauses are preferred over a single `if` inside a `for`.
- force_unwrapping # Force unwrapping should be avoided.
- is_disjoint # Prefer using `Set.isDisjoint(with:)` over `Set.intersection(_:).isEmpty`.
- last_where # Prefer using `.last(where:)` over `.filter { }.last` in collections.
- legacy_multiple # Prefer using the `isMultiple(of:)` function instead of using the remainder operator (`%`).
- lower_acl_than_parent # Ensure definitions have a lower access control level than their enclosing parent
- missing_docs # Declarations should be documented.
- object_literal # Prefer object literals over image and color inits.
- operator_usage_whitespace # Operators should be surrounded by a single whitespace when they are being used.
- overridden_super_call # Some overridden methods should always call super
- private_outlet # IBOutlets should be private to avoid leaking UIKit to higher layers.
- prohibited_super_call # Some methods should not call super, e.g. `UIViewController.loadView()`
- sorted_first_last # Prefer using `min()` or `max()` over `sorted().first` or `sorted().last`
- toggle_bool # Prefer `someBool.toggle()` over `someBool = !someBool`.
- unused_import # All imported modules should be required to make the file compile.
- unused_optional_binding # Prefer `!= nil` over `let _ =`
- unused_declaration # Declarations should be referenced at least once within all files linted.
- void_return # Prefer `-> Void` over `-> ()`.

- file_header

file_header:
required_pattern: |
\/\/
\/\/ SWIFTLINT_CURRENT_FILENAME
\/\/ (GradientLoadingBar|GradientLoadingBar_Example|GradientLoadingBar_Tests|GradientLoadingBar_SnapshotTests)
\/\/
\/\/ Created by .*? on \d{1,2}\/\d{1,2}\/\d{2}\.
\/\/ Created by .*? on \d{2}\.\d{2}\.\d{2}\.
\/\/ Copyright © \d{4} .*?\. All rights reserved\.
\/\/

line_length: 160

included:
- ./
- ../GradientLoadingBar

excluded:
- Pods

custom_rules:
comments_space:
name: 'Space After Comment'
regex: '(^ *//\w+)'
message: 'There should be a space after //.'
severity: warning
empty_line_after_guard:
name: 'Empty Line After Guard'
regex: '(^ *guard[ a-zA-Z0-9=?.\(\),><!]*\{[ a-zA-Z0-9=?.\(\),><!]*\}\n *(?!(?:return|guard))\S+)'
message: 'There should be an empty line after a guard.'
severity: warning
empty_line_after_super:
name: 'Empty Line After Super'
regex: '(^ *super\.[ a-zA-Z0-9=?.\(\)\{\}:,><!]*\n *(?!(?:\}|return))\S+)'
message: 'There should be an empty line after super.'
severity: warning
unnecessary_type:
name: 'Unnecessary Type'
regex: '[ a-zA-Z0-9]*(?:let|var) [ a-zA-Z0-9]*: ([a-zA-Z0-9]*) *= \1'
message: 'Type Definition Not Needed.'
severity: warning
parent_config: Pods/SwiftConfigurationFiles/.swiftlint.yml

40 changes: 6 additions & 34 deletions Example/GradientLoadingBar.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,6 @@
607FACE11AFB9204008FA782 /* Sources */,
607FACE21AFB9204008FA782 /* Frameworks */,
607FACE31AFB9204008FA782 /* Resources */,
972EE1CA201CA5E5001F603C /* Swiftformat */,
97C4F18C1F7F8E7E00739B14 /* Swiftlint */,
);
buildRules = (
);
Expand Down Expand Up @@ -365,7 +363,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 1120;
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1240;
ORGANIZATIONNAME = CocoaPods;
TargetAttributes = {
607FACCF1AFB9204008FA782 = {
Expand Down Expand Up @@ -517,21 +515,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "SWIFTFORMAT=\"${PODS_ROOT}/SwiftFormat/CommandLineTool/swiftformat\"\nif [ ! -f \"$SWIFTFORMAT\" ]; then\n echo \"warning: SwiftFormat not installed!\"\n exit 1\nfi\n\n$SWIFTFORMAT ../\n";
};
972EE1CA201CA5E5001F603C /* Swiftformat */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = Swiftformat;
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "SWIFTFORMAT=\"${PODS_ROOT}/SwiftFormat/CommandLineTool/swiftformat\"\nif [ ! -f \"$SWIFTFORMAT\" ]; then\n echo \"warning: SwiftFormat not installed!\"\n exit 1\nfi\n\n$SWIFTFORMAT ../ --disable \"trailingCommas\"";
shellScript = "SWIFTFORMAT=\"${PODS_ROOT}/SwiftFormat/CommandLineTool/swiftformat\"\nif [ ! -f \"$SWIFTFORMAT\" ]; then\n echo \"warning: SwiftFormat not installed!\"\n exit 1\nfi\n\n$SWIFTFORMAT ../ --config \"${PODS_ROOT}/SwiftConfigurationFiles/.swiftformat\"\n";
};
9753E83D1F80F7D300EF2822 /* Swiftlint */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -547,20 +531,6 @@
shellPath = /bin/sh;
shellScript = "SWIFTLINT=\"${PODS_ROOT}/SwiftLint/swiftlint\"\nif [ ! -f \"$SWIFTLINT\" ]; then\n echo \"warning: SwiftLint not installed!\"\n exit 1\nfi\n\n$SWIFTLINT\n";
};
97C4F18C1F7F8E7E00739B14 /* Swiftlint */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = Swiftlint;
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "SWIFTLINT=\"${PODS_ROOT}/SwiftLint/swiftlint\"\nif [ ! -f \"$SWIFTLINT\" ]; then\n echo \"warning: SwiftLint not installed!\"\n exit 1\nfi\n\n$SWIFTLINT";
};
C6F0F8135CCFB10901DB76DB /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -683,6 +653,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -708,7 +679,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -739,6 +710,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -757,7 +729,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1240"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// AdvancedExampleViewController.swift
// GradientLoadingBar_Example
//
// Created by Felix Mau on 08/30/18.
// Created by Felix Mau on 30.08.18.
// Copyright © 2018 Felix Mau. All rights reserved.
//

Expand Down Expand Up @@ -33,7 +33,7 @@ class AdvancedExampleViewController: UIViewController {

// Source: https://color.adobe.com/Pink-Flamingo-color-theme-10343714/
gradientActivityIndicatorView.gradientColors = [
#colorLiteral(red: 0.9490196078, green: 0.3215686275, blue: 0.431372549, alpha: 1), #colorLiteral(red: 0.9450980392, green: 0.4784313725, blue: 0.5921568627, alpha: 1), #colorLiteral(red: 0.9529411765, green: 0.737254902, blue: 0.7843137255, alpha: 1), #colorLiteral(red: 0.4274509804, green: 0.8666666667, blue: 0.9490196078, alpha: 1), #colorLiteral(red: 0.7568627451, green: 0.9411764706, blue: 0.9568627451, alpha: 1)
#colorLiteral(red: 0.9490196078, green: 0.3215686275, blue: 0.431372549, alpha: 1), #colorLiteral(red: 0.9450980392, green: 0.4784313725, blue: 0.5921568627, alpha: 1), #colorLiteral(red: 0.9529411765, green: 0.737254902, blue: 0.7843137255, alpha: 1), #colorLiteral(red: 0.4274509804, green: 0.8666666667, blue: 0.9490196078, alpha: 1), #colorLiteral(red: 0.7568627451, green: 0.9411764706, blue: 0.9568627451, alpha: 1),
]

return gradientActivityIndicatorView
Expand Down Expand Up @@ -84,7 +84,7 @@ class AdvancedExampleViewController: UIViewController {
programmaticallyGradientActivityIndicatorView.trailingAnchor.constraint(equalTo: programmaticallyButton.trailingAnchor),

programmaticallyGradientActivityIndicatorView.topAnchor.constraint(equalTo: programmaticallyButton.topAnchor),
programmaticallyGradientActivityIndicatorView.heightAnchor.constraint(equalToConstant: Config.height)
programmaticallyGradientActivityIndicatorView.heightAnchor.constraint(equalToConstant: Config.height),
])
}

Expand All @@ -99,7 +99,7 @@ class AdvancedExampleViewController: UIViewController {
customColorsGradientActivityIndicatorView.trailingAnchor.constraint(equalTo: customColorsButton.trailingAnchor),

customColorsGradientActivityIndicatorView.bottomAnchor.constraint(equalTo: customColorsButton.bottomAnchor),
customColorsGradientActivityIndicatorView.heightAnchor.constraint(equalToConstant: Config.height)
customColorsGradientActivityIndicatorView.heightAnchor.constraint(equalToConstant: Config.height),
])
}
}
2 changes: 1 addition & 1 deletion Example/GradientLoadingBar/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// AppDelegate.swift
// GradientLoadingBar
//
// Created by Felix Mau on 09/30/17.
// Created by Felix Mau on 30.09.17.
// Copyright © 2017 Felix Mau. All rights reserved.
//

Expand Down
Loading