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

Commit

Permalink
Remove overriden draw method
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
Luis Padron authored and Luis Padron committed Jan 21, 2017
1 parent b7595d0 commit 270c9f0
Show file tree
Hide file tree
Showing 19 changed files with 185 additions and 84 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# Version 1.1.8

- Remove overriden `draw(rect:)` method to avoid any issues with performance and iOS drawing
- Implemented `prepareForInterfaceBuilder` to still allow for IB designing

- Remove strong refrence to delegate
- UICircularProgressRingDelegate is now a class protocol
- UICircularProgressRingDelegate inside of UICircularProgressRingView is now weak to avoid retain cycle

#### BREAKING CHANGES:

- UICircularProgressRingDelegate is now a `protocol: class` can only be used on `class` types

# Version 1.1.7

Fix bug where progress bar was pixelated inside of tableView from [issue #4](https://github.com/luispadron/UICircularProgressRing/issues/4)
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ To set a value and animate the view

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

## Documentation

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

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

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

## Upcoming enhancements

* ~~Add decreasing animation, currently nothing gets animated when decreasing value~~
* ~~Better way of handling animation finishing, probably a completion block~~

## License

Expand Down
2 changes: 1 addition & 1 deletion UICircularProgressRing.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Pod::Spec.new do |s|

s.name = "UICircularProgressRing"
s.version = "1.1.7"
s.version = "1.1.8"
s.summary = "A highly customizable circular progress bar for iOS written in Swift 3"

s.description = <<-DESC
Expand Down
6 changes: 6 additions & 0 deletions UICircularProgressRing/UICircularProgressRingDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,11 @@
Luis Padron
*/
public protocol UICircularProgressRingDelegate: class {
/**
Delegate call back, called when progress ring is done animating for current value

- Parameter ring: The ring which finished animating

*/
func finishedUpdatingProgress(forRing ring: UICircularProgressRingView)
}
8 changes: 5 additions & 3 deletions UICircularProgressRing/UICircularProgressRingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -579,12 +579,14 @@ import UIKit
}

/**
Overriden because custom drawing is happening in UICircularProgressRingLayer
Prepares to draw the view for use with interface builder
*/
override open func draw(_ rect: CGRect) {

open override func prepareForInterfaceBuilder() {
super.prepareForInterfaceBuilder()
self.setNeedsDisplay()
}


/**
Typealias for the setProgress(:) method closure
*/
Expand Down
4 changes: 2 additions & 2 deletions docs/Classes.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<a class="header-link" href="index.html">
UICircularProgressRing Docs
</a>
(96% documented)
(100% documented)
</p>

<p class="header-col header-col--secondary">
Expand Down Expand Up @@ -123,7 +123,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<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>
<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>
<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>
</section>
</body>
Expand Down
49 changes: 38 additions & 11 deletions docs/Classes/UICircularProgressRingView.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<a class="header-link" href="../index.html">
UICircularProgressRing Docs
</a>
(96% documented)
(100% documented)
</p>

<p class="header-col header-col--secondary">
Expand Down Expand Up @@ -104,9 +104,36 @@ <h3 class="section-name">Delegate</h3>
<li class="item">
<div>
<code>
<a name="/s:vC22UICircularProgressRing26UICircularProgressRingView8delegateGSqPS_30UICircularProgressRingDelegate__"></a>
<a name="/s:C22UICircularProgressRing26UICircularProgressRingView18ProgressCompletion"></a>
<a name="//apple_ref/swift/Alias/ProgressCompletion" class="dashAnchor"></a>
<a class="token" href="#/s:C22UICircularProgressRing26UICircularProgressRingView18ProgressCompletion">ProgressCompletion</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Typealias for the setProgress(:) method closure</p>

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<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>

</div>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/s:vC22UICircularProgressRing26UICircularProgressRingView8delegateXwGSqPS_30UICircularProgressRingDelegate__"></a>
<a name="//apple_ref/swift/Property/delegate" class="dashAnchor"></a>
<a class="token" href="#/s:vC22UICircularProgressRing26UICircularProgressRingView8delegateGSqPS_30UICircularProgressRingDelegate__">delegate</a>
<a class="token" href="#/s:vC22UICircularProgressRing26UICircularProgressRingView8delegateXwGSqPS_30UICircularProgressRingDelegate__">delegate</a>
</code>
</div>
<div class="height-container">
Expand All @@ -132,7 +159,7 @@ <h3 class="section-name">Delegate</h3>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<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>
<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>

</div>
</div>
Expand Down Expand Up @@ -1136,24 +1163,24 @@ <h4>Declaration</h4>
<li class="item">
<div>
<code>
<a name="/s:FC22UICircularProgressRing26UICircularProgressRingView4drawFVSC6CGRectT_"></a>
<a name="//apple_ref/swift/Method/draw(_:)" class="dashAnchor"></a>
<a class="token" href="#/s:FC22UICircularProgressRing26UICircularProgressRingView4drawFVSC6CGRectT_">draw(_:)</a>
<a name="/s:FC22UICircularProgressRing26UICircularProgressRingView26prepareForInterfaceBuilderFT_T_"></a>
<a name="//apple_ref/swift/Method/prepareForInterfaceBuilder()" class="dashAnchor"></a>
<a class="token" href="#/s:FC22UICircularProgressRing26UICircularProgressRingView26prepareForInterfaceBuilderFT_T_">prepareForInterfaceBuilder()</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Overriden because custom drawing is happening in UICircularProgressRingLayer</p>
<p>Prepares to draw the view for use with interface builder</p>

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<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>
<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>

</div>
</div>
Expand Down Expand Up @@ -1206,7 +1233,7 @@ <h4>Declaration</h4>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<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>
<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>

</div>
</div>
Expand Down Expand Up @@ -1267,7 +1294,7 @@ <h4>Parameters</h4>
</article>
</div>
<section class="footer">
<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>
<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>
<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>
</section>
</body>
Expand Down
6 changes: 3 additions & 3 deletions docs/Protocols.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<a class="header-link" href="index.html">
UICircularProgressRing Docs
</a>
(96% documented)
(100% documented)
</p>

<p class="header-col header-col--secondary">
Expand Down Expand Up @@ -104,7 +104,7 @@ <h1>Protocols</h1>
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">UICircularProgressRingDelegate</span></code></pre>
<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>

</div>
</div>
Expand All @@ -119,7 +119,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<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>
<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>
<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>
</section>
</body>
Expand Down
36 changes: 31 additions & 5 deletions docs/Protocols/UICircularProgressRingDelegate.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<a class="header-link" href="../index.html">
UICircularProgressRing Docs
</a>
(96% documented)
(100% documented)
</p>

<p class="header-col header-col--secondary">
Expand Down Expand Up @@ -66,7 +66,7 @@
<h1>UICircularProgressRingDelegate</h1>
<div class="declaration">
<div class="language">
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">UICircularProgressRingDelegate</span></code></pre>
<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>

</div>
</div>
Expand Down Expand Up @@ -103,17 +103,43 @@ <h1>UICircularProgressRingDelegate</h1>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Undocumented</p>
<p>Delegate call back, called when progress ring is done animating for current value</p>

<div class="aside aside-parameter">
<p class="aside-title">Parameter</p>
Parameter ring: The ring which finished animating

</div>

</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">UICircularProgressRingDelegate</span></code></pre>
<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>

</div>
</div>
<div>
<h4>Parameters</h4>
<table class="graybox">
<tbody>
<tr>
<td>
<code>
<em>ring</em>
</code>
</td>
<td>
<div>
<p>The ring which finished animating</p>

</div>
</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
</li>
Expand All @@ -125,7 +151,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<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>
<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>
<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>
</section>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<a class="header-link" href="index.html">
UICircularProgressRing Docs
</a>
(96% documented)
(100% documented)
</p>

<p class="header-col header-col--secondary">
Expand Down Expand Up @@ -123,7 +123,7 @@ <h4>Declaration</h4>
</article>
</div>
<section class="footer">
<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>
<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>
<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>
</section>
</body>
Expand Down
Loading

0 comments on commit 270c9f0

Please sign in to comment.