Skip to content

Commit

Permalink
- Update library to support iOS 9.0
Browse files Browse the repository at this point in the history
- Update README.md
  • Loading branch information
alexhillc committed Jun 21, 2017
1 parent 472aa1a commit 7f4ab0c
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 13 deletions.
4 changes: 2 additions & 2 deletions AXPhotoViewer.podspec
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
Pod::Spec.new do |s|
s.name = "AXPhotoViewer"
s.version = "1.0"
s.version = "1.0-beta.5"
s.license = { :type => 'MIT', :file => 'LICENSE.md' }
s.summary = "An iPhone/iPad photo gallery viewer, useful for viewing a large number of photos."
s.homepage = "https://github.com/alexhillc/AXPhotoViewer"
s.author = { "Alex Hill" => "[email protected]" }
s.source = { :git => "https://github.com/alexhillc/AXPhotoViewer.git", :tag => "v#{s.version}" }

s.platform = :ios, '10.0'
s.platform = :ios, '9.0'
s.requires_arc = true

s.default_subspec = 'Core'
Expand Down
6 changes: 3 additions & 3 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PODS:
- AXPhotoViewer/Core (1.0):
- AXPhotoViewer/Core (1.0-beta.1):
- FLAnimatedImage (>= 1.0.0)
- AXPhotoViewer/Lite (1.0):
- AXPhotoViewer/Lite (1.0-beta.1):
- AXPhotoViewer/Core
- FLAnimatedImage (1.0.12)
- Reveal-SDK (8)
Expand All @@ -15,7 +15,7 @@ EXTERNAL SOURCES:
:path: "../AXPhotoViewer.podspec"

SPEC CHECKSUMS:
AXPhotoViewer: 9affee1d8f6d71a062c0922ea8935cf27e429a3c
AXPhotoViewer: 9c15d3ecaa2b8d63c934fdc8b666b6b47e8fe2b7
FLAnimatedImage: 4a0b56255d9b05f18b6dd7ee06871be5d3b89e31
Reveal-SDK: 43be4e662864e937960d0d04d005135e29c4e53b

Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
# AXPhotoViewer
AXPhotoViewer is an iOS photo viewer that is useful for viewing a very large (or very small!) amount of images and GIFs. This library supports contextual presentation and dismissal, interactive "flick-to-dismiss" behavior, and easily integrates with many third party async image downloading/caching libraries.
AXPhotoViewer is an iOS photo viewer that is useful for viewing a very large (or very small!) amount of images and GIFs. This library supports contextual presentation and dismissal, interactive "flick-to-dismiss" behavior, and easily integrates with many third party async image downloading/caching libraries.

While AXPhotoViewer has many configurable properties on each of its modules, it is easy to throw down some initialization code and get started:

```swift
let dataSource = PhotosDataSource(photos: self.photos, prefetchBehavior: .regular)
let pagingConfig = PagingConfig(navigationOrientation: .horizontal)
let transitionInfo = TransitionInfo(startingView: self.startinImageView) { [weak self] (photo, index) -> UIImageView? in
let transitionInfo = TransitionInfo(startingView: self.startingImageView) { [weak self] (photo, index) -> UIImageView? in
return self?.endingImageView
}

let photosViewController = PhotosViewController(dataSource: dataSource, pagingConfig: pagingConfig, transitionInfo: transitionInfo)
self.present(photosViewController, animated: true, completion: nil)
```

### Objective-C interoperability
This library fully supports interop between Objective-C and Swift codebases. If you run into any issues with this, please open a Github issue or submit a pull request with the suggested changes.

### Installation
Installation can easily be done through Cocoapods:
```ruby
pod install 'AXPhotoViewer', '~> 1.0.0-beta.5'
```
or, if you prefer not to use Cocoapods, add the contents of the 'Source' directory to your project to get started.

More info to come.
34 changes: 29 additions & 5 deletions Source/Classes/CaptionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,14 @@ import UIKit

var defaultTitleAttributes: [String: Any] {
get {
let fontDescriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .body,
var fontDescriptor: UIFontDescriptor
if #available(iOS 10.0, *) {
fontDescriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .body,
compatibleWith: self.traitCollection)
} else {
fontDescriptor = UIFont.preferredFont(forTextStyle: .body).fontDescriptor
}

let font = UIFont.systemFont(ofSize: fontDescriptor.pointSize, weight: UIFontWeightBold)
let textColor = UIColor.white

Expand All @@ -52,8 +58,14 @@ import UIKit

var defaultDescriptionAttributes: [String: Any] {
get {
let fontDescriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .body,
compatibleWith: self.traitCollection)
var fontDescriptor: UIFontDescriptor
if #available(iOS 10.0, *) {
fontDescriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .body,
compatibleWith: self.traitCollection)
} else {
fontDescriptor = UIFont.preferredFont(forTextStyle: .body).fontDescriptor
}

let font = UIFont.systemFont(ofSize: fontDescriptor.pointSize, weight: UIFontWeightLight)
let textColor = UIColor.lightGray

Expand All @@ -66,8 +78,14 @@ import UIKit

var defaultCreditAttributes: [String: Any] {
get {
let fontDescriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .caption1,
var fontDescriptor: UIFontDescriptor
if #available(iOS 10.0, *) {
fontDescriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .caption1,
compatibleWith: self.traitCollection)
} else {
fontDescriptor = UIFont.preferredFont(forTextStyle: .caption1).fontDescriptor
}

let font = UIFont.systemFont(ofSize: fontDescriptor.pointSize, weight: UIFontWeightLight)
let textColor = UIColor.gray

Expand Down Expand Up @@ -233,7 +251,13 @@ import UIKit
return
}

let newFontDescriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: fontTextStyle, compatibleWith: self?.traitCollection)
var newFontDescriptor: UIFontDescriptor
if #available(iOS 10.0, *) {
newFontDescriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: fontTextStyle, compatibleWith: self?.traitCollection)
} else {
newFontDescriptor = UIFont.preferredFont(forTextStyle: fontTextStyle).fontDescriptor
}

let newFont = oldFont.withSize(newFontDescriptor.pointSize)
fontAdjustedAttributedString.removeAttribute(NSFontAttributeName, range: range)
fontAdjustedAttributedString.addAttribute(NSFontAttributeName, value: newFont, range: range)
Expand Down

0 comments on commit 7f4ab0c

Please sign in to comment.