Skip to content

Commit

Permalink
Merge pull request #15 from Yalantis/feature/swift4
Browse files Browse the repository at this point in the history
Feature/swift4
  • Loading branch information
rnkyr authored Oct 16, 2018
2 parents 096ee8b + 229228b commit fbe5266
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 43 deletions.
26 changes: 13 additions & 13 deletions Example/StarWarsAnimations.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@
2A89D8961BD6633300A2C503 /* StarWars */ = {
isa = PBXGroup;
children = (
2A89D8991BD6633300A2C503 /* Info.plist */,
2A89D8971BD6633300A2C503 /* StarWars.h */,
2A89D8A21BD6639700A2C503 /* StarWarsGLAnimator */,
2A89D8B01BD663BD00A2C503 /* StarWarsUIViewAnimator */,
2A89D8AD1BD663A600A2C503 /* StarWarsUIDynamicAnimator */,
2A89D8971BD6633300A2C503 /* StarWars.h */,
2A89D8991BD6633300A2C503 /* Info.plist */,
2A89D8B01BD663BD00A2C503 /* StarWarsUIViewAnimator */,
);
path = StarWars;
sourceTree = "<group>";
Expand Down Expand Up @@ -232,17 +232,17 @@
2ACECE391BA2BF2E005689AD /* StarWarsDemo */ = {
isa = PBXGroup;
children = (
2ACECE411BA2BF2E005689AD /* Assets.xcassets */,
2A977C981BC55CB20038BE80 /* Circular Animation */,
2A977CAB1BC55CE60038BE80 /* Controller */,
2A977CBB1BC55D380038BE80 /* ViewModel */,
2A977CBA1BC55D1C0038BE80 /* View */,
2A977CB71BC55D0F0038BE80 /* Misc */,
2A977CB01BC55CFA0038BE80 /* Extension */,
2A977C981BC55CB20038BE80 /* Circular Animation */,
2A6955691BB584EF009AB18A /* Resources */,
2ACECE3E1BA2BF2E005689AD /* Main.storyboard */,
2ACECE411BA2BF2E005689AD /* Assets.xcassets */,
2ACECE431BA2BF2E005689AD /* LaunchScreen.storyboard */,
2ACECE461BA2BF2E005689AD /* Info.plist */,
2ACECE431BA2BF2E005689AD /* LaunchScreen.storyboard */,
2ACECE3E1BA2BF2E005689AD /* Main.storyboard */,
2A977CB71BC55D0F0038BE80 /* Misc */,
2A6955691BB584EF009AB18A /* Resources */,
2A977CBA1BC55D1C0038BE80 /* View */,
2A977CBB1BC55D380038BE80 /* ViewModel */,
);
name = StarWarsDemo;
path = StarWarsAnimations;
Expand Down Expand Up @@ -569,7 +569,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.Yalantis.StarWars;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -584,7 +584,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.Yalantis.StarWars;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "3x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class MainSettingsViewController: UIViewController {
navigationController!.navigationBar.shadowImage = UIImage()
navigationController!.navigationBar.isTranslucent = true
navigationController!.navigationBar.titleTextAttributes = [
NSFontAttributeName: UIFont(name: "GothamPro", size: 20)!,
NSForegroundColorAttributeName: UIColor.white
NSAttributedStringKey.font: UIFont(name: "GothamPro", size: 20)!,
NSAttributedStringKey.foregroundColor: UIColor.white
]
}

Expand Down
2 changes: 1 addition & 1 deletion Example/StarWarsAnimations/Extension/UIColor+String.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extension UIColor {
var int = UInt32()
Scanner(string: hex).scanHexInt32(&int)
let a, r, g, b: UInt32
switch hex.characters.count {
switch hex.count {
case 3: // RGB (12-bit)
(a, r, g, b) = (255, (int >> 8) * 17, (int >> 4 & 0xF) * 17, (int & 0xF) * 17)
case 6: // RGB (24-bit)
Expand Down
2 changes: 1 addition & 1 deletion Example/StarWarsAnimations/View/StarsOverlay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class StarsOverlay: UIView {
}
}

func randomizeEmitterPosition() {
@objc func randomizeEmitterPosition() {
let sizeWidth = max(bounds.width, bounds.height)
let radius = CGFloat(arc4random()).truncatingRemainder(dividingBy: sizeWidth)
emitter.emitterSize = CGSize(width: radius, height: radius)
Expand Down
3 changes: 1 addition & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2017 Yalantis
Copyright (c) 2018 Yalantis

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

48 changes: 27 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Also, read how it was done in [our blog](https://yalantis.com/blog/uidynamics-ui

- iOS 8.0+
- Xcode 8
- Swift 3
- Swift 4

## Installing with [CocoaPods](https://cocoapods.org)

Expand All @@ -36,12 +36,12 @@ Then just implement class of *UIViewControllerTransitioningDelegate* that will r

```swift
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let destination = segue.destinationViewController
destination.transitioningDelegate = self
let destination = segue.destinationViewController
destination.transitioningDelegate = self
}

func animationControllerForDismissedController(dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
return StarWarsGLAnimator()
return StarWarsGLAnimator()
}
```

Expand All @@ -62,27 +62,33 @@ We’d be really happy if you sent us links to your projects where you use our c

P.S. We’re going to publish more awesomeness wrapped in code and a tutorial on how to make UI for iOS (Android) better than better. Stay tuned!

## Version history

- `1.0` Swift 2.0
- `2.0` Adds Swift 3.0 support
- `3.0` Adds Swift 4.0 support

## License

The MIT License (MIT)
The MIT License (MIT)

Copyright © 2017 Yalantis
Copyright © 2018 Yalantis

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

2 changes: 1 addition & 1 deletion StarWars.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "StarWars"
s.version = "2.0"
s.version = "3.0"
s.summary = "This component implements transition animation to crumble view-controller into tiny pieces"

s.homepage = "https://yalantis.com/blog/uidynamics-uikit-or-opengl-3-types-of-ios-animations-for-the-star-wars/"
Expand Down
2 changes: 1 addition & 1 deletion StarWars/StarWarsGLAnimator/StarWarsGLAnimator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ open class StarWarsGLAnimator: NSObject, UIViewControllerAnimatedTransitioning {
displayLink = nil
}

func displayLinkTick(_ displayLink: CADisplayLink) {
@objc func displayLinkTick(_ displayLink: CADisplayLink) {
if let lastUpdateTime = lastUpdateTime {
let timeSinceLastUpdate = Date.timeIntervalSinceReferenceDate - lastUpdateTime
self.lastUpdateTime = Date.timeIntervalSinceReferenceDate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ open class StarWarsUIDynamicAnimator: NSObject, UIViewControllerAnimatedTransiti
self.transitionContext = transitionContext
}

func completeTransition() {
@objc func completeTransition() {
transitionContext.completeTransition(!transitionContext.transitionWasCancelled)
}
}

0 comments on commit fbe5266

Please sign in to comment.