Skip to content
This repository was archived by the owner on Jan 19, 2022. It is now read-only.

Commit 270c9f0

Browse files
Luis PadronLuis Padron
Luis Padron
authored and
Luis Padron
committed
Remove overriden draw method
- Remove draw(rect:) from UICircularProgressRingView to help with perfomance issues that may have been experienced - Add new prepareForReuse method to allow for IB designing without draw(rect:) - Update README with some tips for retain cycles - Update CHANGELOG to 1.1.8 - Update docs now have 100% documentation - Update UICircularProgressRing.podspec to version 1.1.8
1 parent b7595d0 commit 270c9f0

19 files changed

+185
-84
lines changed

CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
# Version 1.1.8
2+
3+
- Remove overriden `draw(rect:)` method to avoid any issues with performance and iOS drawing
4+
- Implemented `prepareForInterfaceBuilder` to still allow for IB designing
5+
6+
- Remove strong refrence to delegate
7+
- UICircularProgressRingDelegate is now a class protocol
8+
- UICircularProgressRingDelegate inside of UICircularProgressRingView is now weak to avoid retain cycle
9+
10+
#### BREAKING CHANGES:
11+
12+
- UICircularProgressRingDelegate is now a `protocol: class` can only be used on `class` types
13+
114
# Version 1.1.7
215

316
Fix bug where progress bar was pixelated inside of tableView from [issue #4](https://github.com/luispadron/UICircularProgressRing/issues/4)

README.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ To set a value and animate the view
9595

9696
```swift
9797
// Somewhere not in viewDidLoad (since the views have not set yet, thus cannot be animated)
98+
// Remember to use unowned or weak self if refrencing self to avoid retain cycle
9899
progressRing.setProgress(value: 49, animationDuration: 2.0) {
99100
print("Done animating!")
100101
// Do anything your heart desires...
@@ -103,7 +104,7 @@ progressRing.setProgress(value: 49, animationDuration: 2.0) {
103104

104105
## Documentation
105106

106-
Read all about everything there is to know here:
107+
Please read this before creating an issue about how to use the package:
107108

108109
[DOCUMENTATION](http://htmlpreview.github.io/?https://github.com/luispadron/UICircularProgressRing/blob/master/docs/index.html)
109110

@@ -115,10 +116,6 @@ Take a look at the example project over [here](Example/)
115116
2. Open the `Example.xcworkspace` in Xcode
116117
3. Mess around and experiment!
117118

118-
## Upcoming enhancements
119-
120-
* ~~Add decreasing animation, currently nothing gets animated when decreasing value~~
121-
* ~~Better way of handling animation finishing, probably a completion block~~
122119

123120
## License
124121

UICircularProgressRing.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Pod::Spec.new do |s|
33

44
s.name = "UICircularProgressRing"
5-
s.version = "1.1.7"
5+
s.version = "1.1.8"
66
s.summary = "A highly customizable circular progress bar for iOS written in Swift 3"
77

88
s.description = <<-DESC

UICircularProgressRing/UICircularProgressRingDelegate.swift

+6
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,11 @@
3333
Luis Padron
3434
*/
3535
public protocol UICircularProgressRingDelegate: class {
36+
/**
37+
Delegate call back, called when progress ring is done animating for current value
38+
39+
- Parameter ring: The ring which finished animating
40+
41+
*/
3642
func finishedUpdatingProgress(forRing ring: UICircularProgressRingView)
3743
}

UICircularProgressRing/UICircularProgressRingView.swift

+5-3
Original file line numberDiff line numberDiff line change
@@ -579,12 +579,14 @@ import UIKit
579579
}
580580

581581
/**
582-
Overriden because custom drawing is happening in UICircularProgressRingLayer
582+
Prepares to draw the view for use with interface builder
583583
*/
584-
override open func draw(_ rect: CGRect) {
585-
584+
open override func prepareForInterfaceBuilder() {
585+
super.prepareForInterfaceBuilder()
586+
self.setNeedsDisplay()
586587
}
587588

589+
588590
/**
589591
Typealias for the setProgress(:) method closure
590592
*/

docs/Classes.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<a class="header-link" href="index.html">
2020
UICircularProgressRing Docs
2121
</a>
22-
(96% documented)
22+
(100% documented)
2323
</p>
2424

2525
<p class="header-col header-col--secondary">
@@ -123,7 +123,7 @@ <h4>Declaration</h4>
123123
</article>
124124
</div>
125125
<section class="footer">
126-
<p>&copy; 2016 <a class="link" href="https://luispadron.com" target="_blank" rel="external">Luis</a>. All rights reserved. (Last updated: 2016-12-12)</p>
126+
<p>&copy; 2017 <a class="link" href="https://luispadron.com" target="_blank" rel="external">Luis</a>. All rights reserved. (Last updated: 2017-01-20)</p>
127127
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.2</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
128128
</section>
129129
</body>

docs/Classes/UICircularProgressRingView.html

+38-11
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<a class="header-link" href="../index.html">
2121
UICircularProgressRing Docs
2222
</a>
23-
(96% documented)
23+
(100% documented)
2424
</p>
2525

2626
<p class="header-col header-col--secondary">
@@ -104,9 +104,36 @@ <h3 class="section-name">Delegate</h3>
104104
<li class="item">
105105
<div>
106106
<code>
107-
<a name="/s:vC22UICircularProgressRing26UICircularProgressRingView8delegateGSqPS_30UICircularProgressRingDelegate__"></a>
107+
<a name="/s:C22UICircularProgressRing26UICircularProgressRingView18ProgressCompletion"></a>
108+
<a name="//apple_ref/swift/Alias/ProgressCompletion" class="dashAnchor"></a>
109+
<a class="token" href="#/s:C22UICircularProgressRing26UICircularProgressRingView18ProgressCompletion">ProgressCompletion</a>
110+
</code>
111+
</div>
112+
<div class="height-container">
113+
<div class="pointer-container"></div>
114+
<section class="section">
115+
<div class="pointer"></div>
116+
<div class="abstract">
117+
<p>Typealias for the setProgress(:) method closure</p>
118+
119+
</div>
120+
<div class="declaration">
121+
<h4>Declaration</h4>
122+
<div class="language">
123+
<p class="aside-title">Swift</p>
124+
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">typealias</span> <span class="kt">ProgressCompletion</span> <span class="o">=</span> <span class="p">(()</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span></code></pre>
125+
126+
</div>
127+
</div>
128+
</section>
129+
</div>
130+
</li>
131+
<li class="item">
132+
<div>
133+
<code>
134+
<a name="/s:vC22UICircularProgressRing26UICircularProgressRingView8delegateXwGSqPS_30UICircularProgressRingDelegate__"></a>
108135
<a name="//apple_ref/swift/Property/delegate" class="dashAnchor"></a>
109-
<a class="token" href="#/s:vC22UICircularProgressRing26UICircularProgressRingView8delegateGSqPS_30UICircularProgressRingDelegate__">delegate</a>
136+
<a class="token" href="#/s:vC22UICircularProgressRing26UICircularProgressRingView8delegateXwGSqPS_30UICircularProgressRingDelegate__">delegate</a>
110137
</code>
111138
</div>
112139
<div class="height-container">
@@ -132,7 +159,7 @@ <h3 class="section-name">Delegate</h3>
132159
<h4>Declaration</h4>
133160
<div class="language">
134161
<p class="aside-title">Swift</p>
135-
<pre class="highlight"><code><span class="kd">public</span> <span class="k">var</span> <span class="nv">delegate</span><span class="p">:</span> <span class="kt"><a href="../Protocols/UICircularProgressRingDelegate.html">UICircularProgressRingDelegate</a></span><span class="p">?</span></code></pre>
162+
<pre class="highlight"><code><span class="kd">public</span> <span class="k">weak</span> <span class="k">var</span> <span class="nv">delegate</span><span class="p">:</span> <span class="kt"><a href="../Protocols/UICircularProgressRingDelegate.html">UICircularProgressRingDelegate</a></span><span class="p">?</span></code></pre>
136163

137164
</div>
138165
</div>
@@ -1136,24 +1163,24 @@ <h4>Declaration</h4>
11361163
<li class="item">
11371164
<div>
11381165
<code>
1139-
<a name="/s:FC22UICircularProgressRing26UICircularProgressRingView4drawFVSC6CGRectT_"></a>
1140-
<a name="//apple_ref/swift/Method/draw(_:)" class="dashAnchor"></a>
1141-
<a class="token" href="#/s:FC22UICircularProgressRing26UICircularProgressRingView4drawFVSC6CGRectT_">draw(_:)</a>
1166+
<a name="/s:FC22UICircularProgressRing26UICircularProgressRingView26prepareForInterfaceBuilderFT_T_"></a>
1167+
<a name="//apple_ref/swift/Method/prepareForInterfaceBuilder()" class="dashAnchor"></a>
1168+
<a class="token" href="#/s:FC22UICircularProgressRing26UICircularProgressRingView26prepareForInterfaceBuilderFT_T_">prepareForInterfaceBuilder()</a>
11421169
</code>
11431170
</div>
11441171
<div class="height-container">
11451172
<div class="pointer-container"></div>
11461173
<section class="section">
11471174
<div class="pointer"></div>
11481175
<div class="abstract">
1149-
<p>Overriden because custom drawing is happening in UICircularProgressRingLayer</p>
1176+
<p>Prepares to draw the view for use with interface builder</p>
11501177

11511178
</div>
11521179
<div class="declaration">
11531180
<h4>Declaration</h4>
11541181
<div class="language">
11551182
<p class="aside-title">Swift</p>
1156-
<pre class="highlight"><code><span class="k">override</span> <span class="n">open</span> <span class="kd">func</span> <span class="nf">draw</span><span class="p">(</span><span class="n">_</span> <span class="nv">rect</span><span class="p">:</span> <span class="kt">CGRect</span><span class="p">)</span></code></pre>
1183+
<pre class="highlight"><code><span class="n">open</span> <span class="k">override</span> <span class="kd">func</span> <span class="nf">prepareForInterfaceBuilder</span><span class="p">()</span></code></pre>
11571184

11581185
</div>
11591186
</div>
@@ -1206,7 +1233,7 @@ <h4>Declaration</h4>
12061233
<h4>Declaration</h4>
12071234
<div class="language">
12081235
<p class="aside-title">Swift</p>
1209-
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">setProgress</span><span class="p">(</span><span class="nv">value</span><span class="p">:</span> <span class="kt">CGFloat</span><span class="p">,</span> <span class="nv">animationDuration</span><span class="p">:</span> <span class="kt">TimeInterval</span><span class="p">,</span> <span class="nv">completion</span><span class="p">:</span> <span class="p">(()</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)?</span> <span class="o">=</span> <span class="kc">nil</span><span class="p">)</span></code></pre>
1236+
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">setProgress</span><span class="p">(</span><span class="nv">value</span><span class="p">:</span> <span class="kt">CGFloat</span><span class="p">,</span> <span class="nv">animationDuration</span><span class="p">:</span> <span class="kt">TimeInterval</span><span class="p">,</span> <span class="nv">completion</span><span class="p">:</span> <span class="kt"><a href="../Classes/UICircularProgressRingView.html#/s:C22UICircularProgressRing26UICircularProgressRingView18ProgressCompletion">ProgressCompletion</a></span><span class="p">)</span></code></pre>
12101237

12111238
</div>
12121239
</div>
@@ -1267,7 +1294,7 @@ <h4>Parameters</h4>
12671294
</article>
12681295
</div>
12691296
<section class="footer">
1270-
<p>&copy; 2016 <a class="link" href="https://luispadron.com" target="_blank" rel="external">Luis</a>. All rights reserved. (Last updated: 2016-12-12)</p>
1297+
<p>&copy; 2017 <a class="link" href="https://luispadron.com" target="_blank" rel="external">Luis</a>. All rights reserved. (Last updated: 2017-01-20)</p>
12711298
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.2</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
12721299
</section>
12731300
</body>

docs/Protocols.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<a class="header-link" href="index.html">
2020
UICircularProgressRing Docs
2121
</a>
22-
(96% documented)
22+
(100% documented)
2323
</p>
2424

2525
<p class="header-col header-col--secondary">
@@ -104,7 +104,7 @@ <h1>Protocols</h1>
104104
<h4>Declaration</h4>
105105
<div class="language">
106106
<p class="aside-title">Swift</p>
107-
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">UICircularProgressRingDelegate</span></code></pre>
107+
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">UICircularProgressRingDelegate</span><span class="p">:</span> <span class="kd">class</span></code></pre>
108108

109109
</div>
110110
</div>
@@ -119,7 +119,7 @@ <h4>Declaration</h4>
119119
</article>
120120
</div>
121121
<section class="footer">
122-
<p>&copy; 2016 <a class="link" href="https://luispadron.com" target="_blank" rel="external">Luis</a>. All rights reserved. (Last updated: 2016-12-12)</p>
122+
<p>&copy; 2017 <a class="link" href="https://luispadron.com" target="_blank" rel="external">Luis</a>. All rights reserved. (Last updated: 2017-01-20)</p>
123123
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.2</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
124124
</section>
125125
</body>

docs/Protocols/UICircularProgressRingDelegate.html

+31-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<a class="header-link" href="../index.html">
2121
UICircularProgressRing Docs
2222
</a>
23-
(96% documented)
23+
(100% documented)
2424
</p>
2525

2626
<p class="header-col header-col--secondary">
@@ -66,7 +66,7 @@
6666
<h1>UICircularProgressRingDelegate</h1>
6767
<div class="declaration">
6868
<div class="language">
69-
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">UICircularProgressRingDelegate</span></code></pre>
69+
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">UICircularProgressRingDelegate</span><span class="p">:</span> <span class="kd">class</span></code></pre>
7070

7171
</div>
7272
</div>
@@ -103,17 +103,43 @@ <h1>UICircularProgressRingDelegate</h1>
103103
<section class="section">
104104
<div class="pointer"></div>
105105
<div class="abstract">
106-
<p>Undocumented</p>
106+
<p>Delegate call back, called when progress ring is done animating for current value</p>
107+
108+
<div class="aside aside-parameter">
109+
<p class="aside-title">Parameter</p>
110+
Parameter ring: The ring which finished animating
111+
112+
</div>
107113

108114
</div>
109115
<div class="declaration">
110116
<h4>Declaration</h4>
111117
<div class="language">
112118
<p class="aside-title">Swift</p>
113-
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">UICircularProgressRingDelegate</span></code></pre>
119+
<pre class="highlight"><code><span class="kd">func</span> <span class="nf">finishedUpdatingProgress</span><span class="p">(</span><span class="n">forRing</span> <span class="nv">ring</span><span class="p">:</span> <span class="kt"><a href="../Classes/UICircularProgressRingView.html">UICircularProgressRingView</a></span><span class="p">)</span></code></pre>
114120

115121
</div>
116122
</div>
123+
<div>
124+
<h4>Parameters</h4>
125+
<table class="graybox">
126+
<tbody>
127+
<tr>
128+
<td>
129+
<code>
130+
<em>ring</em>
131+
</code>
132+
</td>
133+
<td>
134+
<div>
135+
<p>The ring which finished animating</p>
136+
137+
</div>
138+
</td>
139+
</tr>
140+
</tbody>
141+
</table>
142+
</div>
117143
</section>
118144
</div>
119145
</li>
@@ -125,7 +151,7 @@ <h4>Declaration</h4>
125151
</article>
126152
</div>
127153
<section class="footer">
128-
<p>&copy; 2016 <a class="link" href="https://luispadron.com" target="_blank" rel="external">Luis</a>. All rights reserved. (Last updated: 2016-12-12)</p>
154+
<p>&copy; 2017 <a class="link" href="https://luispadron.com" target="_blank" rel="external">Luis</a>. All rights reserved. (Last updated: 2017-01-20)</p>
129155
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.2</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
130156
</section>
131157
</body>

docs/docsets/UICircularProgressRing.docset/Contents/Resources/Documents/Classes.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<a class="header-link" href="index.html">
2020
UICircularProgressRing Docs
2121
</a>
22-
(96% documented)
22+
(100% documented)
2323
</p>
2424

2525
<p class="header-col header-col--secondary">
@@ -123,7 +123,7 @@ <h4>Declaration</h4>
123123
</article>
124124
</div>
125125
<section class="footer">
126-
<p>&copy; 2016 <a class="link" href="https://luispadron.com" target="_blank" rel="external">Luis</a>. All rights reserved. (Last updated: 2016-12-12)</p>
126+
<p>&copy; 2017 <a class="link" href="https://luispadron.com" target="_blank" rel="external">Luis</a>. All rights reserved. (Last updated: 2017-01-20)</p>
127127
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.7.2</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
128128
</section>
129129
</body>

0 commit comments

Comments
 (0)