Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Keeeeen committed Aug 30, 2018
1 parent ad2ea7c commit 1376644
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 24 deletions.
8 changes: 1 addition & 7 deletions Example/Example/Source/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

final class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
Expand Down Expand Up @@ -40,8 +39,3 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
}

func delay(_ delay: Double, closure: @escaping () -> Void) {
DispatchQueue.main.asyncAfter(deadline: .now() + delay, execute: closure)
}

Original file line number Diff line number Diff line change
Expand Up @@ -65,43 +65,43 @@ class CellTestViewController: UIViewController {
return data
}

delay(1.5) {
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
centerSection
.append(centerCellmodels)
.bump(.left)
}

delay(3) {
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
centerSection
.remove(range: 2...4)
.bump(.right)
}

delay(5) {
DispatchQueue.main.asyncAfter(deadline: .now() + 5) {
self.hakuba
.move(from: 0, to: 1)
.bump()
}

delay(7.5) {
DispatchQueue.main.asyncAfter(deadline: .now() + 7.5) {
topSection
.remove(at: 1)
.bump(.middle)
}

delay(10) {
DispatchQueue.main.asyncAfter(deadline: .now() + 10) {
topSection
.remove(at: 0)
.bump(.right)
}

delay(12.5) {
DispatchQueue.main.asyncAfter(deadline: .now() + 12.5) {
topSection
.remove(at: 0)
.bump(.right)
}

delay(15) {
DispatchQueue.main.asyncAfter(deadline: .now() + 15) {
self.hakuba
.reset()
.bump()
Expand Down
2 changes: 1 addition & 1 deletion Hakuba/Source/Bump/BumpTracker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ final class BumpTracker {
}

func getHakubaBumpType() -> HakubaBumpType {
let indexSet = { (indexes: [Int]) -> IndexSet in
let indexSet: ([Int]) -> IndexSet = { indexes in
let indexSet = NSMutableIndexSet()
for index in indexes {
indexSet.add(index)
Expand Down
6 changes: 3 additions & 3 deletions Hakuba/Source/Core/Hakuba.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ final public class Hakuba: NSObject {

public subscript<T: RawRepresentable & SectionIndexType>(index: T) -> Section {
get {
return self[index.intValue]
return self[index.rawValue]
}
set {
self[index.intValue] = newValue
self[index.rawValue] = newValue
}
}

Expand All @@ -74,7 +74,7 @@ final public class Hakuba: NSObject {
}

public func getSection<T: RawRepresentable & SectionIndexType>(at index: T) -> Section? {
return getSection(at: index.intValue)
return getSection(at: index.rawValue)
}

public init(tableView: UITableView) {
Expand Down
6 changes: 0 additions & 6 deletions Hakuba/Source/Section/SectionIndexType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,3 @@ import Foundation
public protocol SectionIndexType: RawRepresentable where Self.RawValue == Int {
static var count: Int { get }
}

public extension SectionIndexType where Self: RawRepresentable, Self.RawValue == Int {
var intValue: Int {
return rawValue
}
}

0 comments on commit 1376644

Please sign in to comment.