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

Feature/active label #55

Merged
merged 23 commits into from
Jul 8, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
70129d3
- Added ActiveLabel Subclass.
JobsIsMyHomeboy Apr 16, 2019
03639e5
Updated example images for better quality.
JobsIsMyHomeboy Apr 16, 2019
b292157
Revert "Updated example images for better quality."
JobsIsMyHomeboy Apr 16, 2019
a2a3b3d
Updated Readme.
JobsIsMyHomeboy Apr 16, 2019
3847c22
Updated Readme.
JobsIsMyHomeboy Apr 16, 2019
d7cfdb6
- Moved readme images into docs/images folder.
JobsIsMyHomeboy Apr 17, 2019
d11ab46
- Moved ActiveLabelConfiguration inside ActiveLabel class.
JobsIsMyHomeboy Apr 17, 2019
850e53b
- Changed version back to 1.3.5.
JobsIsMyHomeboy Apr 17, 2019
2477648
- Using trailing closure syntax now.
JobsIsMyHomeboy Apr 17, 2019
bb3a7e1
- Added SnapshotTesting framework from pointfree using Carthage.
JobsIsMyHomeboy Apr 19, 2019
168ac20
Merge branch 'master' into feature/ActiveLabel
JobsIsMyHomeboy May 21, 2019
d7bceea
Added State enum to ActiveLabel class.
JobsIsMyHomeboy May 22, 2019
bd5d6ef
Merge branch 'feature/ActiveLabel' of github.com:JobsIsMyHomeboy/iOS-…
JobsIsMyHomeboy May 22, 2019
7cfd6ed
Added documentation to ActiveLabel class to point out that the loadin…
JobsIsMyHomeboy May 22, 2019
d1821d1
Renamed ActiveLabelConfiguration to Configuration since it is namespa…
JobsIsMyHomeboy May 29, 2019
80d806b
Added State initializer that takes an optional string.
JobsIsMyHomeboy Jun 13, 2019
81ddd03
Removed old commented out code.
JobsIsMyHomeboy Jun 18, 2019
f58d92b
Updated travis.yml to add support for Carthage since snapshot tests a…
JobsIsMyHomeboy Jun 18, 2019
3987aff
Updated Changelog to show ActiveLabel addition.
JobsIsMyHomeboy Jun 18, 2019
5d355bc
Changed OS in travis to 12.2.
JobsIsMyHomeboy Jun 18, 2019
484511a
Fixed ActiveLabel subspec.
JobsIsMyHomeboy Jun 18, 2019
d167935
Fixed Codebeat error for too many instance variables on ActiveLabel.C…
JobsIsMyHomeboy Jul 8, 2019
fe9cc31
Refactored out animation part creation into its own method. This shou…
JobsIsMyHomeboy Jul 8, 2019
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
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,24 @@ env:
- WORKSPACE=UtiliKit.xcworkspace
- IOS_FRAMEWORK_SCHEME=UtiliKit-iOS
matrix:
- DESTINATION="platform=iOS Simulator,OS=11.2,name=iPhone X" SCHEME="$IOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" POD_LINT="YES" RUN_DANGER="YES"
- DESTINATION="platform=iOS Simulator,OS=12.2,name=iPhone X" SCHEME="$IOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" POD_LINT="YES" RUN_DANGER="YES"
#- DESTINATION="platform=tvOS Simulator,OS=11.2,name=Apple TV 4K" SCHEME="$TVOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" POD_LINT="NO" RUN_DANGER="NO"
#- DESTINATION="platform=watchOS Simulator,OS=4.2,name=Apple Watch Series 3 - 42mm" SCHEME="$WATCHOS_FRAMEWORK_SCHEME" RUN_TESTS="NO" POD_LINT="NO" RUN_DANGER="NO"
cache:
directories:
- Carthage
- ~/.danger-swift
addons:
homebrew:
update: true
taps:
- danger/tap
packages:
- carthage
- danger-swift
before_install:
- carthage bootstrap --verbose --no-use-binaries --platform iOS,tvOS,watchOS --cache-builds

script:
#- swiftlint
- set -o pipefail
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

##### Enhancements

* Add `ActiveLabel` class to help show activity on a label.
[Brian Miller](https://github.com/JobsIsMyHomeboy)
[#55](https://github.com/BottleRocketStudios/iOS-UtiliKit/pull/55)

* Add support for `Configurable` types when dequeuing reusable views.
[Will McGinty](https://github.com/willmcginty)
[#53](https://github.com/BottleRocketStudios/iOS-UtiliKit/pull/58)
Expand Down
1 change: 1 addition & 0 deletions Cartfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github "pointfreeco/swift-snapshot-testing" ~> 1.5
1 change: 1 addition & 0 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github "pointfreeco/swift-snapshot-testing" "1.5.0"
215 changes: 206 additions & 9 deletions Examples/UtiliKit-iOSExample/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// ActiveLabelViewController.swift
// UtiliKit-iOS
//
// Copyright © 2019 CocoaPods. All rights reserved.
//

import UIKit

class ActiveLabelViewController: UIViewController {
@IBOutlet private var activeLabels: [ActiveLabel]!

override func viewDidLoad() {
super.viewDidLoad()

activeLabels.forEach { $0.text = nil }
}
}
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,50 @@ func containerViewController(_ container: ContainerViewController, animationCont

return nil
}
```

#### ActiveLabel
`ActiveLabel` is a `UILabel` subclass that adds horizontal activity indicators to your label while its `text` property is set to `nil`. You can customize this view quite a bit in code or in Interface Builder to fit your specific needs. The purpose of this subclass is to have a visual indication at the label level while you are loading data into labels.

Default Configuration
``` swift
let label: ActiveLabel = ActiveLabel()
```
![](docs/images/ActiveLabelDefault.gif)

Custom Configuration
``` swift
let label: ActiveLabel = ActiveLabel()
label.estimatedNumberOfLines = 3
label.finalLineTrailingInset = 100
```
![](docs/images/ActiveLabelEdited01.gif)

Custom Configuration using convenience initializer.
``` swift
var configuration = ActiveLabelConfiguration.default
configuration.estimatedNumberOfLines = 3
configuration.finalLineLength = 100
configuration.loadingView.animationDuration = 2.0
configuration.loadingView.animationDelay = 0
let label: ActiveLabel = ActiveLabel(frame: CGRect(x: 0, y: 0, width: 335, height: 21), configuration: configuration)
```
![](docs/images/ActiveLabelEdited02.gif)

Add some color, change line height and spacing.
``` swift
let label: ActiveLabel = ActiveLabel()
label.estimatedNumberOfLines = 3
label.finalLineTrailingInset = 100
label.loadingView.color = UIColor(red: 233.0/255.0, green: 231.0/255.0, blue: 237.0/255.0, alpha: 1.0))
label.loadingView.lineHeight = 16
label.loadingView.lineVerticalSpacing = 8
```
![](docs/images/ActiveLabelEdited03.gif)

When initializing `ActiveLabel` in Storyboards or Xibs you must set the labels text to `nil` in code because IB initializes labels with an empty string value.

When using `ActiveLabel` for snapshot tests you can center the gradient by calling `configureForSnapshotTest()` on your label.

### Example

Expand Down
Loading