Skip to content

Commit

Permalink
Merge pull request #16 from MountainBuffalo/example
Browse files Browse the repository at this point in the history
Added playground example
  • Loading branch information
jay18001 authored Jun 8, 2017
2 parents 40a0112 + d829955 commit 69ff206
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
coverage:

ignore: # files and folders for processing
- CacherTests
- Example/*
3 changes: 3 additions & 0 deletions Cacher.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cacher/ImageCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ extension UIImage: Cacheable {
}
}

class ImageCache: Cache<UIImage> {
public class ImageCache: Cache<UIImage> {
public static var shared = ImageCache()
}
26 changes: 26 additions & 0 deletions Example/Playground.playground/Contents.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//: Playground - noun: a place where people can play

import UIKit
import Cacher
import PlaygroundSupport

PlaygroundPage.current.needsIndefiniteExecution = true

//Get the url from the file in the bundle
let fameworkBundle = Bundle(for: ImageCache.self)
let imageUrl = fameworkBundle.url(forResource: "cacher", withExtension: "png")

//Set up the image view
let imageView = UIImageView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
imageView.backgroundColor = UIColor.brown

//Add the set the live view
PlaygroundPage.current.liveView = imageView

sleep(1)

//Set the image url
imageView.set(url: imageUrl!, cacheType: .memory, completion: { _ in
imageView.backgroundColor = UIColor.blue
})

4 changes: 4 additions & 0 deletions Example/Playground.playground/contents.xcplayground
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='5.0' target-platform='ios'>
<timeline fileName='timeline.xctimeline'/>
</playground>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions Example/Playground.playground/timeline.xctimeline
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<Timeline
version = "3.0">
<TimelineItems>
<LoggerValueHistoryTimelineItem
documentLocation = "#CharacterRangeLen=0&amp;CharacterRangeLoc=703&amp;EndingColumnNumber=10&amp;EndingLineNumber=26&amp;StartingColumnNumber=1&amp;StartingLineNumber=26&amp;Timestamp=517802861.659419"
selectedRepresentationIndex = "0"
shouldTrackSuperviewWidth = "NO">
</LoggerValueHistoryTimelineItem>
</TimelineItems>
</Timeline>

0 comments on commit 69ff206

Please sign in to comment.