Commit 8530c668 by Daniel Dahan

added CHANGELOG and fixed snapshot issue in iOS 11

parent ce1eaaed
## 1.2.2
* Updated Motion for iOS 11, where snapshot would no longer include a container view.
## 1.2.1
* Submodule access rights update for [Material](https://github.com/CosmicMind/Material).
## 1.2.0
* Updated to `Swift 4`.
* Fixed a couple memory leaks.
## 1.1.2
* Minor internal updates.
## 1.1.1
* Added Motion logo to README.
## 1.1.0
* [issue-5](https://github.com/CosmicMind/Motion/issues/5): Added the ability to add custom timing functions.
* [issue-4](https://github.com/CosmicMind/Motion/issues/4): Fixed an issue where a white flash occurred when pushing/popping a view controller.
* [issue-8](https://github.com/CosmicMind/Motion/issues/8): Added the ability to add animation immediately.
* [issue-6](https://github.com/CosmicMind/Motion/issues/6): Added the ability to animate views that are not paired.
Pod::Spec.new do |s|
s.name = 'Motion'
s.version = '1.2.1'
s.version = '1.2.2'
s.license = 'MIT'
s.summary = 'A library used to create beautiful animations and transitions for Apple devices.'
s.homepage = 'http://cosmicmind.com'
......
......@@ -129,11 +129,11 @@ In the above code example, a box view is created with a width of 100, height of
> **Embedded frameworks require a minimum deployment target of iOS 8.**
> - [Download Motion](https://github.com/CosmicMind/Motion/archive/master.zip)
Visit the [Installation](https://cosmicmind.gitbooks.io/motion/content/installation.html) page to learn how to install Motion using [CocoaPods](http://cocoapods.org) and [Carthage](https://github.com/Carthage/Carthage).
Read [Material - It's time to download](https://www.cosmicmind.com/danieldahan/lesson/6) to learn how to install Material using [GitHub](http://github.com), [CocoaPods](http://cocoapods.org), and [Carthage](https://github.com/Carthage/Carthage).
## Change Log
Motion is a growing project and will encounter changes throughout its development. It is recommended that the [Change Log](https://cosmicmind.gitbooks.io/motion/content/change_log.html) be reviewed prior to updating versions.
Motion is a growing project and will encounter changes throughout its development. It is recommended that the [Change Log](https://github.com/CosmicMind/Motion/blob/master/CHANGELOG.md) be reviewed prior to updating versions.
## License
......
......@@ -210,7 +210,13 @@ internal extension UIView {
}
internal class SnapshotWrapperView: UIView {
/// A reference to the contentView.
let contentView: UIView
/**
An initializer that takes in a contentView.
- Parameter contentView: A UIView.
*/
init(contentView: UIView) {
self.contentView = contentView
super.init(frame: contentView.frame)
......@@ -269,7 +275,7 @@ internal extension UIView {
let movePoints = realFromPos.distance(realToPos) + realFromSize.bottomRight.distance(realToSize.bottomRight)
// duration is 0.2 @ 0 to 0.375 @ 500
// Duration is 0.2 @ 0 to 0.375 @ 500
return 0.208 + Double(movePoints.clamp(0, 500)) / 3000
}
......@@ -298,7 +304,7 @@ internal extension UIView {
let snapshot = snapshotView(afterScreenUpdates: true)
if #available(iOS 11.0, *), let oldSnapshot = snapshot {
/// iOS 11 no longer contains a container view.
// iOS 11 no longer contains a container view.
return SnapshotWrapperView(contentView: oldSnapshot)
}
......
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.2.1</string>
<string>1.2.2</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
......
......@@ -191,14 +191,14 @@ public extension MotionContext {
unhide(view: view)
/// Capture a snapshot without alpha & cornerRadius.
// Capture a snapshot without alpha & cornerRadius.
let oldCornerRadius = view.layer.cornerRadius
let oldAlpha = view.alpha
view.layer.cornerRadius = 0
view.alpha = 1
let snapshot: UIView
let snapshotType: MotionSnapshotType = self[view]?.snapshotType ?? .optimized
let snapshotType = self[view]?.snapshotType ?? MotionSnapshotType.optimized
switch snapshotType {
case .normal:
......@@ -209,7 +209,7 @@ public extension MotionContext {
case .noSnapshot:
if view.superview != container {
if superviewToNoSnapshotSubviewMap[view.superview!] == nil {
if nil == superviewToNoSnapshotSubviewMap[view.superview!] {
superviewToNoSnapshotSubviewMap[view.superview!] = []
}
......@@ -222,20 +222,23 @@ public extension MotionContext {
#if os(tvOS)
snapshot = view.snapshotView(afterScreenUpdates: true)!
#else
if #available(iOS 9.0, *), let stackView = view as? UIStackView {
snapshot = stackView.slowSnapshotView()
} else if let imageView = view as? UIImageView, view.subviews.isEmpty {
let contentView = UIImageView(image: imageView.image)
contentView.frame = imageView.bounds
contentView.contentMode = imageView.contentMode
contentView.tintColor = imageView.tintColor
contentView.backgroundColor = imageView.backgroundColor
let snapShotView = UIView()
snapShotView.addSubview(contentView)
snapshot = snapShotView
} else if let barView = view as? UINavigationBar, barView.isTranslucent {
let newBarView = UINavigationBar(frame: barView.frame)
newBarView.barStyle = barView.barStyle
newBarView.tintColor = barView.tintColor
newBarView.barTintColor = barView.barTintColor
......@@ -243,14 +246,17 @@ public extension MotionContext {
// take a snapshot without the background
barView.layer.sublayers![0].opacity = 0
let realSnapshot = barView.snapshotView(afterScreenUpdates: true)!
barView.layer.sublayers![0].opacity = 1
newBarView.addSubview(realSnapshot)
snapshot = newBarView
} else if let effectView = view as? UIVisualEffectView {
snapshot = UIVisualEffectView(effect: effectView.effect)
snapshot.frame = effectView.bounds
} else {
snapshot = view.snapshotView() ?? UIView()
}
......@@ -272,10 +278,10 @@ public extension MotionContext {
snapshot.layer.bounds = view.layer.bounds
snapshot.motionIdentifier = view.motionIdentifier
if snapshotType != .noSnapshot {
if .noSnapshot != snapshotType {
if !(view is UINavigationBar), let contentView = snapshot.subviews.get(0) {
// the Snapshot's contentView must have hold the cornerRadius value,
// since the snapshot might not have maskToBounds set
// The Snapshot's contentView must have hold the cornerRadius value,
// since the snapshot might not have maskToBounds set.
contentView.layer.cornerRadius = view.layer.cornerRadius
contentView.layer.masksToBounds = true
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment