Skip to content

Commit

Permalink
Merge branch 'release/3.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
pisces committed May 29, 2024
2 parents b9d9ef7 + c318763 commit 8e7c884
Show file tree
Hide file tree
Showing 23 changed files with 281 additions and 175 deletions.
49 changes: 13 additions & 36 deletions Example/Pods/Pods.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "brian-gomes-n_qeUPl4QCM-unsplash-916.jpg",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "brian-gomes-n_qeUPl4QCM-unsplash-916 1.jpg",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "brian-gomes-n_qeUPl4QCM-unsplash.jpg",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "brian-gomes-n_qeUPl4QCM-unsplash 1.jpg",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17506" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="22505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17505"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22504"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand All @@ -18,7 +18,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7JW-co-Hv4">
<rect key="frame" x="50" y="296" width="314" height="314"/>
<rect key="frame" x="50" y="298" width="314" height="314"/>
<color key="backgroundColor" systemColor="systemIndigoColor"/>
<constraints>
<constraint firstAttribute="width" secondItem="7JW-co-Hv4" secondAttribute="height" multiplier="1:1" id="bye-2e-JXj"/>
Expand Down Expand Up @@ -54,15 +54,15 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Glz-yY-fMx">
<rect key="frame" x="0.0" y="196" width="414" height="414"/>
<rect key="frame" x="0.0" y="198" width="414" height="414"/>
<color key="backgroundColor" systemColor="systemIndigoColor"/>
<constraints>
<constraint firstAttribute="width" secondItem="Glz-yY-fMx" secondAttribute="height" multiplier="1:1" id="gsu-Y6-Jwx"/>
</constraints>
</view>
</subviews>
<viewLayoutGuide key="safeArea" id="BXx-kM-j6X"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.69999999999999996" colorSpace="custom" customColorSpace="calibratedRGB"/>
<color key="backgroundColor" systemColor="systemPinkColor"/>
<constraints>
<constraint firstItem="Glz-yY-fMx" firstAttribute="leading" secondItem="BXx-kM-j6X" secondAttribute="leading" id="84j-zN-svk"/>
<constraint firstItem="Glz-yY-fMx" firstAttribute="centerY" secondItem="BXx-kM-j6X" secondAttribute="centerY" constant="-50" id="Ca1-JV-Yhm"/>
Expand All @@ -81,10 +81,13 @@
</scenes>
<resources>
<systemColor name="systemIndigoColor">
<color red="0.34509803921568627" green="0.33725490196078434" blue="0.83921568627450982" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.34509803919999998" green="0.33725490200000002" blue="0.83921568629999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemPinkColor">
<color red="1" green="0.1764705882" blue="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
<systemColor name="systemTealColor">
<color red="0.35294117647058826" green="0.78431372549019607" blue="0.98039215686274506" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.18823529410000001" green="0.69019607839999997" blue="0.78039215689999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</systemColor>
</resources>
</document>
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,26 @@
import UIViewControllerTransitions

final class DemoViewController: UITableViewController {

private let titles: [String] = [
"DragDrop",
"Move",
"Fade",
"Move for Navigation",
"Zoom"
]

private enum Item: String, CaseIterable {
case dragDrop
case move
case fade
case moveForNavigation
case zoom

var title: String {
rawValue.capitalized
}
var isNavigationTransition: Bool {
switch self {
case .moveForNavigation:
return true
default:
return false
}
}
}

override func viewDidLoad() {
super.viewDidLoad()
Expand All @@ -53,7 +65,7 @@ final class DemoViewController: UITableViewController {
return 1
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return titles.count
return Item.allCases.count
}
override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 70
Expand All @@ -70,34 +82,31 @@ final class DemoViewController: UITableViewController {
return cell!
}
override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
cell.textLabel?.text = titles[indexPath.row]
cell.textLabel?.text = Item.allCases[indexPath.row].title
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
var viewController: UIViewController?

switch indexPath.row {
case 0:
viewController = DragDropTransitionFirstViewController(nibName: "DragDropTransitionFirstView", bundle: .main)
case 1:
viewController = MoveTransitionFirstViewController(nibName: "MoveTransitionFirstView", bundle: .main)
case 2:
viewController = FadeTransitionFirstViewController(nibName: "FadeTransitionFirstView", bundle: .main)
case 3:
viewController = NavigationMoveTransitionFirstViewController(nibName: "NavigationMoveTransitionFirstView", bundle: .main)
case 4:
viewController = UIStoryboard(name: "ZoomTransition", bundle: nil).instantiateViewController(withIdentifier: "FirstScene")
default:
break
}

guard let controller = viewController else {return}

if indexPath.row == 3 {
let navigationController = UINavigationController(rootViewController: controller)
let item = Item.allCases[indexPath.row]
let viewController: UIViewController = {
switch $0 {
case .dragDrop:
return DragDropTransitionFirstViewController(nibName: "DragDropTransitionFirstView", bundle: .main)
case .move:
return MoveTransitionFirstViewController(nibName: "MoveTransitionFirstView", bundle: .main)
case .fade:
return FadeTransitionFirstViewController(nibName: "FadeTransitionFirstView", bundle: .main)
case .moveForNavigation:
return NavigationMoveTransitionFirstViewController(nibName: "NavigationMoveTransitionFirstView", bundle: .main)
case .zoom:
return UIStoryboard(name: "ZoomTransition", bundle: nil).instantiateViewController(withIdentifier: "FirstScene")
}
}(item)

if item.isNavigationTransition {
let navigationController = UINavigationController(rootViewController: viewController)
navigationController.modalPresentationStyle = .fullScreen
present(navigationController, animated: true, completion: nil)
} else {
navigationController?.pushViewController(controller, animated: true)
navigationController?.pushViewController(viewController, animated: true)
}
}
}
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ navigationController.push(secondViewController, animated: true, completion: nil)
$ gem install cocoapods
```

> CocoaPods 1.1.0+ is required to build UIViewControllerTransitions 3.4+.
> CocoaPods 1.1.0+ is required to build UIViewControllerTransitions.
To integrate UIViewControllerTransitions into your Xcode project using CocoaPods, specify it in your `Podfile`:

Expand All @@ -647,7 +647,7 @@ source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'

target '<Your Target Name>' do
pod 'UIViewControllerTransitions', '~> 3.4'
pod 'UIViewControllerTransitions', '~> 3.5'
end
```

Expand All @@ -671,7 +671,7 @@ $ brew install carthage
To integrate UIViewControllerTransitions into your Xcode project using Carthage, specify it in your `Cartfile`:

```ogdl
github "pisces/UIViewControllerTransitions" ~> 3.4
github "pisces/UIViewControllerTransitions" ~> 3.5
```

Run `carthage update` to build the framework and drag the built `UIViewControllerTransitions.framework` into your Xcode project.
Expand Down
2 changes: 1 addition & 1 deletion UIViewControllerTransitions.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = "UIViewControllerTransitions"
s.version = "3.4.3"
s.version = "3.5.0"
s.summary = "UIViewController Transitioning Library."
s.description = "This library helps you to apply and create Custom UIViewController Transitions."
s.homepage = "https://github.com/pisces/UIViewControllerTransitions"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,43 @@

import Foundation

public protocol TransitionCompatible {
public protocol TransitionCompatible: AnyObject {
associatedtype CompatibleType

var transition: TransitionWrapper<CompatibleType> { get }
}

extension TransitionCompatible {
public var transition: TransitionWrapper<Self> {
TransitionWrapper(self)
guard let value = objc_getAssociatedObject(self, &keyForTransition) as? TransitionWrapper<Self> else {
let value = TransitionWrapper(self)
objc_setAssociatedObject(self, &keyForTransition, value, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
return value
}
return value
}
}

public final class TransitionWrapper<Base> {
public let base: Base

public init(_ base: Base) {
self.base = base
}

public let base: Base

public var id: String? {
get {
objc_getAssociatedObject(base, &keyForTransitionID) as? String
}
set {
objc_setAssociatedObject(base, &keyForTransitionID, newValue, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}
}

public func clear() {
id = nil
}
}

private var keyForTransition: UInt8 = 0
private var keyForTransitionID: UInt8 = 0
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
@end

@interface UINavigationControllerTransition : AbstractTransition <UINavigationControllerDelegate, UINavigationControllerTransitionProtected>
@property (nonatomic) BOOL isEnabled;
@property (nullable, nonatomic, weak) UINavigationController *navigationController;
@property (nullable, nonatomic, strong) AbstractInteractiveTransition *interactor;
@end
Expand Down
Loading

0 comments on commit 8e7c884

Please sign in to comment.