Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .mention-bot
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"maxReviewers": 2
}
40 changes: 40 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
included: # paths to include during linting. `--path` is ignored if present.
- Source
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Carthage
- Pods

# configurable rules can be customized from this configuration file
# binary rules can set their severity level
force_cast: warning # implicitly
force_try:
severity: warning # explicitly
# rules that have both warning and error levels, can set just the warning level
# implicitly
line_length: 200
# they can set both implicitly with an array
type_body_length:
- 300 # warning
- 400 # error
# or they can set both explicitly
file_length:
warning: 500
error: 1200
# naming rules can set warnings/errors for min_length and max_length
# additionally they can set excluded names
type_name:
min_length: 3 # only warning
max_length: # warning and error
warning: 40
error: 50
excluded: iPhone # excluded via string
variable_name:
min_length: # only min_length
error: 2 # only error
excluded: # excluded via string array
- x
- y
- id
- URL
- GlobalAPIKey
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle)
3 changes: 2 additions & 1 deletion Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
github "hyperoslo/Cache" "5af9d7f80b5c39ec578c54874d5acda248d10831"
github "krzyzanowskim/CryptoSwift" "0.4.1"
github "hyperoslo/Cache" "36ef82487589ad6c91cfc66308ff0c799512b9d6"
14 changes: 14 additions & 0 deletions Imaginary.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
D5DF758E1C403D8200BF1AB6 /* Headers */,
D5DF758F1C403D8200BF1AB6 /* Resources */,
D5DF75B31C403FC700BF1AB6 /* Run Script */,
BD58C3AF1CF30382003F7141 /* ShellScript */,
);
buildRules = (
);
Expand Down Expand Up @@ -180,6 +181,19 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
BD58C3AF1CF30382003F7141 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi";
};
D5DF75B31C403FC700BF1AB6 /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down
2 changes: 1 addition & 1 deletion Source/Data/Capsule.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

class Capsule : NSObject {
class Capsule: NSObject {

static var ObjectKey = 0
let value: Any
Expand Down
2 changes: 1 addition & 1 deletion Source/Data/Fetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class Fetcher {

func complete(closure: () -> Void) {
active = false

dispatch_async(dispatch_get_main_queue()) {
closure()
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Extensions/UIImageView+Imaginary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ extension UIImageView {
return fetcher
}
set (fetcher) {
var wrapper : Capsule?
var wrapper: Capsule?
if let fetcher = fetcher {
wrapper = Capsule(value: fetcher)
}
Expand Down
8 changes: 5 additions & 3 deletions Source/Imaginary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public struct Imaginary {
public static var preConfigure: ((imageView: UIImageView) -> Void)? = { imageView in
imageView.layer.opacity = 0.0
}

public static var transitionClosure: ((imageView: UIImageView, image: UIImage) -> Void) = { imageView, newImage in
guard let oldImage = imageView.image else {
imageView.image = newImage
Expand All @@ -31,14 +31,16 @@ public struct Imaginary {
}

public var imageCache: Cache<UIImage> {

struct Static {
static let config = Config(
frontKind: .Memory,
backKind: .Disk,
expiry: .Date(NSDate().dateByAddingTimeInterval(60 * 60 * 24 * 3)),
maxSize: 0)
maxSize: 0,
maxObjects: 10)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be configurable in the future, but right now 10 felt like a good amount.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😇


static let cache = Cache<UIImage>(name: "Imaginary")
static let cache = Cache<UIImage>(name: "Imaginary", config: config)
}

return Static.cache
Expand Down