Skip to content

Commit 6c57eca

Browse files
committed
Updated demo code and sample screenshot.
1 parent 67c052a commit 6c57eca

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Diff for: Calculus2.playground/Contents.swift

+5-4
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class GraphView : UIView
163163
let previousX = x - self.interval
164164
var rangeContainsPreviousX = true
165165

166-
if let range = equation.graphingDomain
166+
if let range = equation.drawingDomain
167167
{
168168
// Don't draw dangling lines at the start of the graph.
169169
rangeContainsPreviousX = range.contains(previousX)
@@ -485,18 +485,19 @@ func demo()
485485
*/
486486
graph.autoUpdatesAfterAddingEquation = false
487487

488+
let parabola = Exponential(exponent: 2)
488489
let line = Line(slope: 1.0, offset: 3.0)
489490
let sine = Sine()
490-
491491
let cosine = Cosine(period: 1.0, amplitude: 1.0, phaseShift: -1.0, verticalShift: 0.0)
492492
cosine.drawingColor = UIColor(red: 0.7, green: 0.2, blue: 0.2, alpha: 1.0)
493-
cosine.domain = Range(uncheckedBounds: (lower: 0.0, upper: 10.0))
493+
cosine.drawingDomain = Range(uncheckedBounds: (lower: 0.0, upper: 10.0))
494494

495+
graph.addEquation(parabola)
495496
graph.addEquation(cosine)
496497
graph.addEquation(line)
497498

498499
//: You can add these yourself.
499-
// graph.addEquation(sine)
500+
graph.addEquation(sine)
500501

501502
// Necessary only if `autoUpdatesAfterAddingEquation` is `false`.
502503
graph.setNeedsDisplay()

Diff for: demo.png

186 KB
Loading

0 commit comments

Comments
 (0)