Commit c3ff9361 by Daniel Dahan

initial phase to Swift 4 complete

parent 3130a55c
...@@ -1036,14 +1036,14 @@ ...@@ -1036,14 +1036,14 @@
attributes = { attributes = {
LastSwiftMigration = 0710; LastSwiftMigration = 0710;
LastSwiftUpdateCheck = 0730; LastSwiftUpdateCheck = 0730;
LastUpgradeCheck = 0800; LastUpgradeCheck = 0900;
ORGANIZATIONNAME = "CosmicMind, Inc."; ORGANIZATIONNAME = "CosmicMind, Inc.";
TargetAttributes = { TargetAttributes = {
963832351B88DFD80015F710 = { 963832351B88DFD80015F710 = {
CreatedOnToolsVersion = 6.4; CreatedOnToolsVersion = 6.4;
DevelopmentTeam = 9Z76XCNLGL; DevelopmentTeam = 9Z76XCNLGL;
DevelopmentTeamName = "CosmicMind Inc."; DevelopmentTeamName = "CosmicMind Inc.";
LastSwiftMigration = 0800; LastSwiftMigration = 0900;
ProvisioningStyle = Manual; ProvisioningStyle = Manual;
}; };
}; };
...@@ -1215,14 +1215,20 @@ ...@@ -1215,14 +1215,20 @@
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
...@@ -1254,6 +1260,7 @@ ...@@ -1254,6 +1260,7 @@
PRODUCT_NAME = Material; PRODUCT_NAME = Material;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0; SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
...@@ -1269,14 +1276,20 @@ ...@@ -1269,14 +1276,20 @@
CLANG_CXX_LIBRARY = "libc++"; CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES; CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
...@@ -1300,6 +1313,7 @@ ...@@ -1300,6 +1313,7 @@
PRODUCT_NAME = Material; PRODUCT_NAME = Material;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 3.0; SWIFT_VERSION = 3.0;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES; VALIDATE_PRODUCT = YES;
...@@ -1329,7 +1343,8 @@ ...@@ -1329,7 +1343,8 @@
PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE = "";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0; SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
}; };
name = Debug; name = Debug;
}; };
...@@ -1354,7 +1369,8 @@ ...@@ -1354,7 +1369,8 @@
PROVISIONING_PROFILE = ""; PROVISIONING_PROFILE = "";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0; SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
}; };
name = Release; name = Release;
}; };
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "0830" LastUpgradeVersion = "0900"
version = "1.3"> version = "1.3">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES">
<Testables> <Testables>
<TestableReference <TestableReference
...@@ -55,6 +56,7 @@ ...@@ -55,6 +56,7 @@
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"
......
...@@ -770,21 +770,28 @@ extension Motion: UITabBarControllerDelegate { ...@@ -770,21 +770,28 @@ extension Motion: UITabBarControllerDelegate {
} }
} }
public typealias MotionDelayCancelBlock = (Bool) -> Void public typealias MotionCancelBlock = (Bool) -> Void
extension Motion { extension Motion {
/** /**
Executes a block of code asynchronously on the main thread.
- Parameter execute: A block that is executed asynchronously on the main thread.
*/
public class func async(_ execute: @escaping () -> Void) {
Motion.delay(0, execute: execute)
}
/**
Executes a block of code after a time delay. Executes a block of code after a time delay.
- Parameter duration: An animation duration time. - Parameter _ time: A delay time.
- Parameter animations: An animation block. - Parameter execute: A block that is executed once delay has passed.
- Parameter execute block: A completion block that is executed once - Returns: An optional MotionCancelBlock.
the animations have completed.
*/ */
@discardableResult @discardableResult
public class func delay(_ time: TimeInterval, execute: @escaping () -> Void) -> MotionDelayCancelBlock? { public class func delay(_ time: TimeInterval, execute: @escaping () -> Void) -> MotionCancelBlock? {
var cancelable: MotionDelayCancelBlock? var cancelable: MotionCancelBlock?
let delayed: MotionDelayCancelBlock = { let delayed: MotionCancelBlock = {
if !$0 { if !$0 {
DispatchQueue.main.async(execute: execute) DispatchQueue.main.async(execute: execute)
} }
...@@ -802,10 +809,10 @@ extension Motion { ...@@ -802,10 +809,10 @@ extension Motion {
} }
/** /**
Cancels the delayed MotionDelayCancelBlock. Cancels the delayed MotionCancelBlock.
- Parameter delayed completion: An MotionDelayCancelBlock. - Parameter delayed completion: An MotionCancelBlock.
*/ */
public class func cancel(delayed completion: MotionDelayCancelBlock) { public class func cancel(delayed completion: MotionCancelBlock) {
completion(true) completion(true)
} }
......
...@@ -227,6 +227,16 @@ public extension MotionAnimation { ...@@ -227,6 +227,16 @@ public extension MotionAnimation {
} }
} }
/**
Animates a view's current position to the given x and y values.
- Parameter x: A CGloat.
- Parameter y: A CGloat.
- Returns: A MotionAnimation.
*/
static func position(x: CGFloat, y: CGFloat) -> MotionAnimation {
return .position(CGPoint(x: x, y: y))
}
/// Fades the view in during an animation. /// Fades the view in during an animation.
static var fadeIn = MotionAnimation.fade(1) static var fadeIn = MotionAnimation.fade(1)
...@@ -267,6 +277,16 @@ public extension MotionAnimation { ...@@ -267,6 +277,16 @@ public extension MotionAnimation {
} }
/** /**
Animates the view's current size to the given width and height.
- Parameter width: A CGFloat.
- Parameter height: A CGFloat.
- Returns: A MotionAnimation.
*/
static func size(width: CGFloat, height: CGFloat) -> MotionAnimation {
return .size(CGSize(width: width, height: height))
}
/**
Animates a view's current shadow path to the given one. Animates a view's current shadow path to the given one.
- Parameter path: A CGPath. - Parameter path: A CGPath.
- Returns: A MotionAnimation. - Returns: A MotionAnimation.
......
...@@ -310,6 +310,7 @@ internal extension MotionController { ...@@ -310,6 +310,7 @@ internal extension MotionController {
Subclasses should call context.set(fromViews: toViews) after Subclasses should call context.set(fromViews: toViews) after
inserting fromViews & toViews into the container inserting fromViews & toViews into the container
*/ */
@objc
func prepareTransition() { func prepareTransition() {
guard isTransitioning else { guard isTransitioning else {
return return
...@@ -323,6 +324,7 @@ internal extension MotionController { ...@@ -323,6 +324,7 @@ internal extension MotionController {
} }
/// Prepares the transition fromView & toView pairs. /// Prepares the transition fromView & toView pairs.
@objc
func prepareTransitionPairs() { func prepareTransitionPairs() {
guard isTransitioning else { guard isTransitioning else {
return return
...@@ -358,6 +360,7 @@ internal extension MotionController { ...@@ -358,6 +360,7 @@ internal extension MotionController {
Animates the views. Subclasses should call `prepareTransition` & Animates the views. Subclasses should call `prepareTransition` &
`prepareTransitionPairs` before calling `animate`. `prepareTransitionPairs` before calling `animate`.
*/ */
@objc
func animate() { func animate() {
guard isTransitioning else { guard isTransitioning else {
return return
...@@ -424,6 +427,7 @@ internal extension MotionController { ...@@ -424,6 +427,7 @@ internal extension MotionController {
- Parameter isFinished: A Boolean indicating if the transition - Parameter isFinished: A Boolean indicating if the transition
has completed. has completed.
*/ */
@objc
func complete(isFinished: Bool) { func complete(isFinished: Bool) {
guard isTransitioning else { guard isTransitioning else {
return return
......
...@@ -234,6 +234,16 @@ public extension MotionTransition { ...@@ -234,6 +234,16 @@ public extension MotionTransition {
} }
} }
/**
Animates a view's current position to the given x and y values.
- Parameter x: A CGloat.
- Parameter y: A CGloat.
- Returns: A MotionTransition.
*/
static func position(x: CGFloat, y: CGFloat) -> MotionTransition {
return .position(CGPoint(x: x, y: y))
}
/// Forces the view to not fade during a transition. /// Forces the view to not fade during a transition.
static var forceNonFade = MotionTransition { static var forceNonFade = MotionTransition {
$0.nonFade = true $0.nonFade = true
...@@ -279,6 +289,16 @@ public extension MotionTransition { ...@@ -279,6 +289,16 @@ public extension MotionTransition {
} }
/** /**
Animates the view's current size to the given width and height.
- Parameter width: A CGFloat.
- Parameter height: A CGFloat.
- Returns: A MotionTransition.
*/
static func size(width: CGFloat, height: CGFloat) -> MotionTransition {
return .size(CGSize(width: width, height: height))
}
/**
Animates the view's current shadow path to the given one. Animates the view's current shadow path to the given one.
- Parameter path: A CGPath. - Parameter path: A CGPath.
- Returns: A MotionTransition. - Returns: A MotionTransition.
......
...@@ -57,47 +57,47 @@ public enum CharacterAttribute: String { ...@@ -57,47 +57,47 @@ public enum CharacterAttribute: String {
public func CharacterAttributeToValue(attribute: CharacterAttribute) -> String { public func CharacterAttributeToValue(attribute: CharacterAttribute) -> String {
switch attribute { switch attribute {
case .font: case .font:
return NSFontAttributeName return NSAttributedStringKey.font.rawValue
case .paragraphStyle: case .paragraphStyle:
return NSParagraphStyleAttributeName return NSAttributedStringKey.paragraphStyle.rawValue
case .forgroundColor: case .forgroundColor:
return NSForegroundColorAttributeName return NSAttributedStringKey.foregroundColor.rawValue
case .backgroundColor: case .backgroundColor:
return NSBackgroundColorAttributeName return NSAttributedStringKey.backgroundColor.rawValue
case .ligature: case .ligature:
return NSLigatureAttributeName return NSAttributedStringKey.ligature.rawValue
case .kern: case .kern:
return NSKernAttributeName return NSAttributedStringKey.kern.rawValue
case .strikethroughStyle: case .strikethroughStyle:
return NSStrikethroughStyleAttributeName return NSAttributedStringKey.strikethroughStyle.rawValue
case .underlineStyle: case .underlineStyle:
return NSUnderlineStyleAttributeName return NSAttributedStringKey.underlineStyle.rawValue
case .strokeColor: case .strokeColor:
return NSStrokeColorAttributeName return NSAttributedStringKey.strokeColor.rawValue
case .strokeWidth: case .strokeWidth:
return NSStrokeWidthAttributeName return NSAttributedStringKey.strokeWidth.rawValue
case .shadow: case .shadow:
return NSShadowAttributeName return NSAttributedStringKey.shadow.rawValue
case .textEffect: case .textEffect:
return NSTextEffectAttributeName return NSAttributedStringKey.textEffect.rawValue
case .attachment: case .attachment:
return NSAttachmentAttributeName return NSAttributedStringKey.attachment.rawValue
case .link: case .link:
return NSLinkAttributeName return NSAttributedStringKey.link.rawValue
case .baselineOffset: case .baselineOffset:
return NSBaselineOffsetAttributeName return NSAttributedStringKey.baselineOffset.rawValue
case .underlineColor: case .underlineColor:
return NSUnderlineColorAttributeName return NSAttributedStringKey.underlineColor.rawValue
case .strikethroughColor: case .strikethroughColor:
return NSStrikethroughColorAttributeName return NSAttributedStringKey.strikethroughColor.rawValue
case .obliqueness: case .obliqueness:
return NSObliquenessAttributeName return NSAttributedStringKey.obliqueness.rawValue
case .expansion: case .expansion:
return NSExpansionAttributeName return NSAttributedStringKey.expansion.rawValue
case .writingDirection: case .writingDirection:
return NSWritingDirectionAttributeName return NSAttributedStringKey.writingDirection.rawValue
case .verticalGlyphForm: case .verticalGlyphForm:
return NSVerticalGlyphFormAttributeName return NSAttributedStringKey.verticalGlyphForm.rawValue
} }
} }
...@@ -109,7 +109,7 @@ extension NSMutableAttributedString { ...@@ -109,7 +109,7 @@ extension NSMutableAttributedString {
- Parameter range: A NSRange. - Parameter range: A NSRange.
*/ */
open func add(characterAttribute: CharacterAttribute, value: Any, range: NSRange) { open func add(characterAttribute: CharacterAttribute, value: Any, range: NSRange) {
addAttribute(CharacterAttributeToValue(attribute: characterAttribute), value: value, range: range) addAttribute(NSAttributedStringKey(rawValue: CharacterAttributeToValue(attribute: characterAttribute)), value: value, range: range)
} }
/** /**
...@@ -151,7 +151,7 @@ extension NSMutableAttributedString { ...@@ -151,7 +151,7 @@ extension NSMutableAttributedString {
- Parameter range: A NSRange. - Parameter range: A NSRange.
*/ */
open func remove(characterAttribute: CharacterAttribute, range: NSRange) { open func remove(characterAttribute: CharacterAttribute, range: NSRange) {
removeAttribute(CharacterAttributeToValue(attribute: characterAttribute), range: range) removeAttribute(NSAttributedStringKey(rawValue: CharacterAttributeToValue(attribute: characterAttribute)), range: range)
} }
/** /**
......
...@@ -94,7 +94,7 @@ private class FontLoader { ...@@ -94,7 +94,7 @@ private class FontLoader {
let font = CGFont(provider) let font = CGFont(provider)
var error: Unmanaged<CFError>? var error: Unmanaged<CFError>?
if !CTFontManagerRegisterGraphicsFont(font, &error) { if !CTFontManagerRegisterGraphicsFont(font!, &error) {
let errorDescription = CFErrorCopyDescription(error!.takeUnretainedValue()) let errorDescription = CFErrorCopyDescription(error!.takeUnretainedValue())
let nsError = error!.takeUnretainedValue() as Any as! Error let nsError = error!.takeUnretainedValue() as Any as! Error
NSException(name: .internalInconsistencyException, reason: errorDescription as String?, userInfo: [NSUnderlyingErrorKey: nsError as Any]).raise() NSException(name: .internalInconsistencyException, reason: errorDescription as String?, userInfo: [NSUnderlyingErrorKey: nsError as Any]).raise()
......
...@@ -41,7 +41,7 @@ extension UIFont { ...@@ -41,7 +41,7 @@ extension UIFont {
open func stringSize(string: String, constrainedTo width: CGFloat) -> CGSize { open func stringSize(string: String, constrainedTo width: CGFloat) -> CGSize {
return string.boundingRect(with: CGSize(width: width, height: CGFloat(Double.greatestFiniteMagnitude)), return string.boundingRect(with: CGSize(width: width, height: CGFloat(Double.greatestFiniteMagnitude)),
options: NSStringDrawingOptions.usesLineFragmentOrigin, options: NSStringDrawingOptions.usesLineFragmentOrigin,
attributes: [NSFontAttributeName: self], attributes: [NSAttributedStringKey.font: self],
context: nil).size context: nil).size
} }
} }
...@@ -123,6 +123,7 @@ extension UIView { ...@@ -123,6 +123,7 @@ extension UIView {
width or height property is set, the other will be automatically adjusted width or height property is set, the other will be automatically adjusted
to maintain the shape of the object. to maintain the shape of the object.
*/ */
@objc
open var shapePreset: ShapePreset { open var shapePreset: ShapePreset {
get { get {
return layer.shapePreset return layer.shapePreset
...@@ -223,6 +224,7 @@ extension UIView { ...@@ -223,6 +224,7 @@ extension UIView {
} }
/// A property that sets the cornerRadius of the backing layer. /// A property that sets the cornerRadius of the backing layer.
@objc
open var cornerRadiusPreset: CornerRadiusPreset { open var cornerRadiusPreset: CornerRadiusPreset {
get { get {
return layer.cornerRadiusPreset return layer.cornerRadiusPreset
......
...@@ -109,7 +109,7 @@ open class SearchBar: Bar { ...@@ -109,7 +109,7 @@ open class SearchBar: Bar {
open var placeholder: String? { open var placeholder: String? {
didSet { didSet {
if let v = placeholder { if let v = placeholder {
textField.attributedPlaceholder = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderColor]) textField.attributedPlaceholder = NSAttributedString(string: v, attributes: [NSAttributedStringKey.foregroundColor: placeholderColor])
} }
} }
} }
...@@ -119,7 +119,7 @@ open class SearchBar: Bar { ...@@ -119,7 +119,7 @@ open class SearchBar: Bar {
open var placeholderColor = Color.darkText.others { open var placeholderColor = Color.darkText.others {
didSet { didSet {
if let v = placeholder { if let v = placeholder {
textField.attributedPlaceholder = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderColor]) textField.attributedPlaceholder = NSAttributedString(string: v, attributes: [NSAttributedStringKey.foregroundColor: placeholderColor])
} }
} }
} }
......
...@@ -115,7 +115,7 @@ open class SnackbarController: TransitionController { ...@@ -115,7 +115,7 @@ open class SnackbarController: TransitionController {
- Parameter status: A SnackbarStatus enum value. - Parameter status: A SnackbarStatus enum value.
*/ */
@discardableResult @discardableResult
open func animate(snackbar status: SnackbarStatus, delay: TimeInterval = 0, animations: ((Snackbar) -> Void)? = nil, completion: ((Snackbar) -> Void)? = nil) -> MotionDelayCancelBlock? { open func animate(snackbar status: SnackbarStatus, delay: TimeInterval = 0, animations: ((Snackbar) -> Void)? = nil, completion: ((Snackbar) -> Void)? = nil) -> MotionCancelBlock? {
return Motion.delay(delay) { [weak self, status = status, animations = animations, completion = completion] in return Motion.delay(delay) { [weak self, status = status, animations = animations, completion = completion] in
guard let s = self else { guard let s = self else {
return return
......
...@@ -408,19 +408,19 @@ fileprivate extension TabBar { ...@@ -408,19 +408,19 @@ fileprivate extension TabBar {
selectedTabItem = tabItem selectedTabItem = tabItem
line.animate(.duration(0.25), line.animate(.duration(0.25),
.size(CGSize(width: tabItem.width, height: lineHeight)), .size(width: tabItem.width, height: lineHeight),
.position(CGPoint(x: tabItem.center.x, y: .bottom == lineAlignment ? height - lineHeight / 2 : lineHeight / 2)), .position(x: tabItem.center.x, y: .bottom == lineAlignment ? height - lineHeight / 2 : lineHeight / 2),
.completion { [weak self, isTriggeredByUserInteraction = isTriggeredByUserInteraction, tabItem = tabItem, completion = completion] _ in .completion({ [weak self, isTriggeredByUserInteraction = isTriggeredByUserInteraction, tabItem = tabItem, completion = completion] in
guard let s = self else { guard let s = self else {
return return
} }
if isTriggeredByUserInteraction { if isTriggeredByUserInteraction {
s.delegate?.tabBar?(tabBar: s, didSelect: tabItem) s.delegate?.tabBar?(tabBar: s, didSelect: tabItem)
} }
completion?(tabItem) completion?(tabItem)
}) }))
updateScrollView() updateScrollView()
} }
......
...@@ -360,7 +360,7 @@ extension TabsController { ...@@ -360,7 +360,7 @@ extension TabsController {
return return
} }
Motion.delay(0) { [weak self] in Motion.async { [weak self] in
guard let s = self else { guard let s = self else {
return return
} }
......
...@@ -105,7 +105,7 @@ extension TextStorage { ...@@ -105,7 +105,7 @@ extension TextStorage {
If you don't need this value, pass NULL. If you don't need this value, pass NULL.
- Returns: The attributes for the character at index. - Returns: The attributes for the character at index.
*/ */
open override func attributes(at location: Int, effectiveRange range: NSRangePointer?) -> [String: Any] { open override func attributes(at location: Int, effectiveRange range: NSRangePointer?) -> [NSAttributedStringKey: Any] {
return storage.attributes(at: location, effectiveRange: range) return storage.attributes(at: location, effectiveRange: range)
} }
...@@ -126,7 +126,7 @@ extension TextStorage { ...@@ -126,7 +126,7 @@ extension TextStorage {
- Parameter range: A range of characters that will have their - Parameter range: A range of characters that will have their
attributes updated. attributes updated.
*/ */
open override func setAttributes(_ attrs: [String : Any]?, range: NSRange) { open override func setAttributes(_ attrs: [NSAttributedStringKey : Any]?, range: NSRange) {
storage.setAttributes(attrs, range: range) storage.setAttributes(attrs, range: range)
edited(.editedAttributes, range: range, changeInLength: 0) edited(.editedAttributes, range: range, changeInLength: 0)
} }
...@@ -138,7 +138,7 @@ extension TextStorage { ...@@ -138,7 +138,7 @@ extension TextStorage {
- Parameter range: A range of characters that will have their - Parameter range: A range of characters that will have their
attributes added. attributes added.
*/ */
open override func addAttribute(_ name: String, value: Any, range: NSRange) { open override func addAttribute(_ name: NSAttributedStringKey, value: Any, range: NSRange) {
storage.addAttribute(name, value: value, range: range) storage.addAttribute(name, value: value, range: range)
edited(.editedAttributes, range: range, changeInLength: 0) edited(.editedAttributes, range: range, changeInLength: 0)
} }
...@@ -149,7 +149,7 @@ extension TextStorage { ...@@ -149,7 +149,7 @@ extension TextStorage {
- Parameter range: A range of characters that will have their - Parameter range: A range of characters that will have their
attributes removed. attributes removed.
*/ */
open override func removeAttribute(_ name: String, range: NSRange) { open override func removeAttribute(_ name: NSAttributedStringKey, range: NSRange) {
storage.removeAttribute(name, range: range) storage.removeAttribute(name, range: range)
edited(.editedAttributes, range: range, changeInLength: 0) edited(.editedAttributes, range: range, changeInLength: 0)
} }
......
...@@ -162,6 +162,7 @@ internal extension TransitionController { ...@@ -162,6 +162,7 @@ internal extension TransitionController {
} }
/// A method that prepares the rootViewController. /// A method that prepares the rootViewController.
@objc
func prepareRootViewController() { func prepareRootViewController() {
prepare(viewController: rootViewController, in: container) prepare(viewController: rootViewController, in: container)
} }
......
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