Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into cdz/scroll-captions
Browse files Browse the repository at this point in the history
  • Loading branch information
cdzombak committed Jan 4, 2016
2 parents 4acbeeb + b6c3153 commit 5d1a27d
Show file tree
Hide file tree
Showing 69 changed files with 3,263 additions and 966 deletions.
6 changes: 6 additions & 0 deletions Example/Images.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
7 changes: 4 additions & 3 deletions Example/NYTPhotoViewer-Swift/ExamplePhoto.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,20 @@ import UIKit
class ExamplePhoto: NSObject, NYTPhoto {

var image: UIImage?
var imageData: NSData?
var placeholderImage: UIImage?
let attributedCaptionTitle: NSAttributedString
let attributedCaptionSummary = NSAttributedString(string: "summary string", attributes: [NSForegroundColorAttributeName: UIColor.grayColor()])
let attributedCaptionCredit = NSAttributedString(string: "credit", attributes: [NSForegroundColorAttributeName: UIColor.darkGrayColor()])

init(image: UIImage?, attributedCaptionTitle: NSAttributedString) {
self.image = image
init(imageData: NSData?, attributedCaptionTitle: NSAttributedString) {
self.imageData = imageData
self.attributedCaptionTitle = attributedCaptionTitle
super.init()
}

convenience init(attributedCaptionTitle: NSAttributedString) {
self.init(image: nil, attributedCaptionTitle: attributedCaptionTitle)
self.init(imageData: nil, attributedCaptionTitle: attributedCaptionTitle)
}

}
78 changes: 76 additions & 2 deletions Example/NYTPhotoViewer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
8CD283E21ABE455A00ADD109 /* NYTPhotosOverlayViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CD283E11ABE455A00ADD109 /* NYTPhotosOverlayViewTests.swift */; };
8CD283E41ABE624200ADD109 /* NYTScalingImageViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CD283E31ABE624200ADD109 /* NYTScalingImageViewTests.swift */; };
8CD283E61ABE6F6600ADD109 /* NYTPhotoTransitionAnimatorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8CD283E51ABE6F6600ADD109 /* NYTPhotoTransitionAnimatorTests.swift */; };
934B3EA91BD54CE400953DC1 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5A8195388D20070C39A /* Images.xcassets */; settings = {ASSET_TAGS = (); }; };
934B3EAA1BD54CE400953DC1 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5A8195388D20070C39A /* Images.xcassets */; settings = {ASSET_TAGS = (); }; };
934B3EA91BD54CE400953DC1 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5A8195388D20070C39A /* Images.xcassets */; };
934B3EAA1BD54CE400953DC1 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6003F5A8195388D20070C39A /* Images.xcassets */; };
94195E1720FF535F0D8447E6 /* libPods-NYTPhotoViewer-SwiftTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 03C738E753BE4DA373A7BC05 /* libPods-NYTPhotoViewer-SwiftTests.a */; };
955BE815A0B486203B80D541 /* libPods-NYTPhotoViewer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1477DE9B8584BD5335F644E1 /* libPods-NYTPhotoViewer.a */; };
B5B252E11A8BE10B00E9973E /* NYTExamplePhoto.m in Sources */ = {isa = PBXBuildFile; fileRef = B5B252E01A8BE10B00E9973E /* NYTExamplePhoto.m */; };
Expand All @@ -53,6 +53,10 @@
B5DC9D911A9F793200F4F81F /* NYTPhotoTransitionAnimatorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B5DC9D901A9F793200F4F81F /* NYTPhotoTransitionAnimatorTests.m */; };
B5DC9D9A1A9FB0C000F4F81F /* NYTPhotosDataSourceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B5DC9D991A9FB0C000F4F81F /* NYTPhotosDataSourceTests.m */; };
C2764961179EFD3A4397B4F6 /* libPods-NYTPhotoViewer-Swift.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C25ACCAFE75703E4107C21D /* libPods-NYTPhotoViewer-Swift.a */; };
EC1B97111BA675DC00C9C9FD /* giphy.gif in Resources */ = {isa = PBXBuildFile; fileRef = EC1B97101BA675DC00C9C9FD /* giphy.gif */; };
EC1B97121BA675DC00C9C9FD /* giphy.gif in Resources */ = {isa = PBXBuildFile; fileRef = EC1B97101BA675DC00C9C9FD /* giphy.gif */; };
EC1B97131BA67E6700C9C9FD /* giphy.gif in Resources */ = {isa = PBXBuildFile; fileRef = EC1B97101BA675DC00C9C9FD /* giphy.gif */; };
EC1B97141BA67E6700C9C9FD /* giphy.gif in Resources */ = {isa = PBXBuildFile; fileRef = EC1B97101BA675DC00C9C9FD /* giphy.gif */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -133,6 +137,7 @@
B5DC9D991A9FB0C000F4F81F /* NYTPhotosDataSourceTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NYTPhotosDataSourceTests.m; sourceTree = "<group>"; };
C260A188D0E255B25171088B /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
C3A795E41A9CE3AA00A5AF55 /* NYTPhotoViewer.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = NYTPhotoViewer.podspec; path = ../NYTPhotoViewer.podspec; sourceTree = "<group>"; };
EC1B97101BA675DC00C9C9FD /* giphy.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = giphy.gif; sourceTree = "<group>"; };
FA400B174395C59C5DF305C6 /* Pods-NYTPhotoViewer.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NYTPhotoViewer.release.xcconfig"; path = "Pods/Target Support Files/Pods-NYTPhotoViewer/Pods-NYTPhotoViewer.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -222,6 +227,7 @@
6003F593195388D20070C39A /* NYTPhotoViewer */ = {
isa = PBXGroup;
children = (
EC1B97101BA675DC00C9C9FD /* giphy.gif */,
6003F59C195388D20070C39A /* NYTAppDelegate.h */,
6003F59D195388D20070C39A /* NYTAppDelegate.m */,
6003F59F195388D20070C39A /* Main_iPhone.storyboard */,
Expand Down Expand Up @@ -361,6 +367,7 @@
6003F587195388D20070C39A /* Frameworks */,
6003F588195388D20070C39A /* Resources */,
B4CAEB715688F67681460AC0 /* Copy Pods Resources */,
8975164C9391D50029B0D9A8 /* Embed Pods Frameworks */,
);
buildRules = (
);
Expand All @@ -380,6 +387,7 @@
6003F5AB195388D20070C39A /* Frameworks */,
6003F5AC195388D20070C39A /* Resources */,
3396FFBCD072196C2CD78193 /* Copy Pods Resources */,
14EF1A8C861C784674008D25 /* Embed Pods Frameworks */,
);
buildRules = (
);
Expand All @@ -400,6 +408,7 @@
8C4464DD1ABCA3BA00BD79F1 /* Frameworks */,
8C4464DE1ABCA3BA00BD79F1 /* Resources */,
327A116448D64B7DF9EBE3CA /* Copy Pods Resources */,
35F41AE6056EA168FC8FDCAF /* Embed Pods Frameworks */,
);
buildRules = (
);
Expand All @@ -419,6 +428,7 @@
8C4464F11ABCA3BA00BD79F1 /* Frameworks */,
8C4464F21ABCA3BA00BD79F1 /* Resources */,
9F9185D07ADDCE84D01D6062 /* Copy Pods Resources */,
4A3E2FF23078350CB8D4ECDB /* Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -482,6 +492,7 @@
6003F5A4195388D20070C39A /* Main_iPad.storyboard in Resources */,
6003F5A9195388D20070C39A /* Images.xcassets in Resources */,
6003F5A1195388D20070C39A /* Main_iPhone.storyboard in Resources */,
EC1B97111BA675DC00C9C9FD /* giphy.gif in Resources */,
6003F598195388D20070C39A /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -490,6 +501,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
EC1B97131BA67E6700C9C9FD /* giphy.gif in Resources */,
6003F5BA195388D20070C39A /* InfoPlist.strings in Resources */,
934B3EA91BD54CE400953DC1 /* Images.xcassets in Resources */,
);
Expand All @@ -501,6 +513,7 @@
files = (
8C4464EA1ABCA3BA00BD79F1 /* Main.storyboard in Resources */,
8C838AC51AC7777D00D754D3 /* Images.xcassets in Resources */,
EC1B97121BA675DC00C9C9FD /* giphy.gif in Resources */,
8C4464EF1ABCA3BA00BD79F1 /* LaunchScreen.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -509,13 +522,29 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
EC1B97141BA67E6700C9C9FD /* giphy.gif in Resources */,
934B3EAA1BD54CE400953DC1 /* Images.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
14EF1A8C861C784674008D25 /* Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Tests/Pods-Tests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
327A116448D64B7DF9EBE3CA /* Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -546,6 +575,36 @@
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Tests/Pods-Tests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
35F41AE6056EA168FC8FDCAF /* Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-NYTPhotoViewer-Swift/Pods-NYTPhotoViewer-Swift-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
4A3E2FF23078350CB8D4ECDB /* Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-NYTPhotoViewer-SwiftTests/Pods-NYTPhotoViewer-SwiftTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
77060F753544EBF4A399EF7E /* Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -576,6 +635,21 @@
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
8975164C9391D50029B0D9A8 /* Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-NYTPhotoViewer/Pods-NYTPhotoViewer-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
9F9185D07ADDCE84D01D6062 /* Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down
1 change: 1 addition & 0 deletions Example/NYTPhotoViewer/NYTExamplePhoto.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

// Redeclare all the properties as readwrite for sample/testing purposes.
@property (nonatomic) UIImage *image;
@property (nonatomic) NSData *imageData;
@property (nonatomic) UIImage *placeholderImage;
@property (nonatomic) NSAttributedString *attributedCaptionTitle;
@property (nonatomic) NSAttributedString *attributedCaptionSummary;
Expand Down
17 changes: 13 additions & 4 deletions Example/NYTPhotoViewer/NYTViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ typedef NS_ENUM(NSUInteger, NYTViewControllerPhotoIndex) {
NYTViewControllerPhotoIndexDefaultLoadingSpinner = 3,
NYTViewControllerPhotoIndexNoReferenceView = 4,
NYTViewControllerPhotoIndexCustomMaxZoomScale = 5,
NYTViewControllerPhotoIndexGif = 6,
NYTViewControllerPhotoCount,
};

@interface NYTViewController () <NYTPhotosViewControllerDelegate>
Expand All @@ -42,7 +44,7 @@ - (void)updateImagesOnPhotosViewController:(NYTPhotosViewController *)photosView
CGFloat updateImageDelay = 5.0;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(updateImageDelay * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
for (NYTExamplePhoto *photo in photos) {
if (!photo.image) {
if (!photo.image && !photo.imageData) {
// Photo credit: Nic Lehoux
photo.image = [UIImage imageNamed:@"NYTimesBuilding"];
[photosViewController updateImageForPhoto:photo];
Expand All @@ -54,12 +56,16 @@ - (void)updateImagesOnPhotosViewController:(NYTPhotosViewController *)photosView
+ (NSArray *)newTestPhotos {
NSMutableArray *photos = [NSMutableArray array];

for (int i = 0; i < 6; i++) {
for (NSUInteger i = 0; i < NYTViewControllerPhotoCount; i++) {
NYTExamplePhoto *photo = [[NYTExamplePhoto alloc] init];

photo.image = [UIImage imageNamed:@"NYTimesBuilding"];
if (i == NYTViewControllerPhotoIndexCustomEverything || i == NYTViewControllerPhotoIndexDefaultLoadingSpinner) {
if (i == NYTViewControllerPhotoIndexGif) {
photo.imageData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"giphy" ofType:@"gif"]];
} else if (i == NYTViewControllerPhotoIndexCustomEverything || i == NYTViewControllerPhotoIndexDefaultLoadingSpinner) {
// no-op, left here for clarity:
photo.image = nil;
} else {
photo.image = [UIImage imageNamed:@"NYTimesBuilding"];
}

if (i == NYTViewControllerPhotoIndexCustomEverything) {
Expand All @@ -83,6 +89,9 @@ + (NSArray *)newTestPhotos {
case NYTViewControllerPhotoIndexCustomMaxZoomScale:
caption = @"photo with custom maximum zoom scale";
break;
case NYTViewControllerPhotoIndexGif:
caption = @"animated GIF";
break;
}

photo.attributedCaptionTitle = [[NSAttributedString alloc] initWithString:@(i + 1).stringValue attributes:@{NSForegroundColorAttributeName: [UIColor whiteColor], NSFontAttributeName: [UIFont preferredFontForTextStyle:UIFontTextStyleBody]}];
Expand Down
Binary file added Example/NYTPhotoViewer/giphy.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions Example/NYTPhotoViewer/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ int main(int argc, char * argv[])
return UIApplicationMain(argc, argv, nil, NSStringFromClass([NYTAppDelegate class]));
}
}

10 changes: 5 additions & 5 deletions Example/Podfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
source 'https://github.com/CocoaPods/Specs.git'

target 'NYTPhotoViewer', :exclusive => true do
pod "NYTPhotoViewer", :path => "../"
pod "NYTPhotoViewer/AnimatedGifSupport", :path => "../"
end

target 'Tests', :exclusive => true do
pod "NYTPhotoViewer", :path => "../"
pod "NYTPhotoViewer/AnimatedGifSupport", :path => "../"
pod 'OCMock', '~> 3.2'
end

target 'NYTPhotoViewer-Swift', :exclusive => true do
pod "NYTPhotoViewer", :path => "../"
pod "NYTPhotoViewer/AnimatedGifSupport", :path => "../"
end

target 'NYTPhotoViewer-SwiftTests', :exclusive => true do
pod "NYTPhotoViewer", :path => "../"
pod "NYTPhotoViewer/AnimatedGifSupport", :path => "../"
pod 'OCMock', '~> 3.2'
end
end
13 changes: 9 additions & 4 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
PODS:
- NYTPhotoViewer (0.1.2)
- FLAnimatedImage (1.0.10)
- NYTPhotoViewer/AnimatedGifSupport (0.1.2):
- FLAnimatedImage
- NYTPhotoViewer/Core
- NYTPhotoViewer/Core (0.1.2)
- OCMock (3.2)

DEPENDENCIES:
- NYTPhotoViewer (from `../`)
- NYTPhotoViewer/AnimatedGifSupport (from `../`)
- OCMock (~> 3.2)

EXTERNAL SOURCES:
NYTPhotoViewer:
:path: "../"

SPEC CHECKSUMS:
NYTPhotoViewer: d852216690e0496bf925abab1350be0f547d93bd
FLAnimatedImage: e16a1e1cef08e4c509b47e4acbe3923f65c16135
NYTPhotoViewer: c8cdb47350ae4dacd248771a6dbe6ba67c65c3a1
OCMock: 28def049ef47f996b515a8eeea958be7ccab2dbb

COCOAPODS: 0.38.2
COCOAPODS: 0.39.0
Loading

0 comments on commit 5d1a27d

Please sign in to comment.