Skip to content
This repository was archived by the owner on Nov 15, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ExampleApp/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool {
// Override point for customization after application launch.
return true
}

func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
Expand Down
8 changes: 3 additions & 5 deletions ExampleApp/Table Example/Custom Footer/TableFooterExample.xib
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand All @@ -25,12 +24,11 @@
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="EcM-2G-Fff" firstAttribute="centerY" secondItem="vEs-cy-DNe" secondAttribute="centerY" id="CeK-mW-AEa"/>
<constraint firstItem="BTY-Ub-l0q" firstAttribute="trailing" secondItem="EcM-2G-Fff" secondAttribute="trailing" constant="15" id="bfb-4j-NuL"/>
<constraint firstItem="EcM-2G-Fff" firstAttribute="leading" secondItem="BTY-Ub-l0q" secondAttribute="leading" constant="15" id="ji2-jC-ALH"/>
<constraint firstAttribute="trailing" secondItem="EcM-2G-Fff" secondAttribute="trailing" constant="15" id="bfb-4j-NuL"/>
<constraint firstItem="EcM-2G-Fff" firstAttribute="leading" secondItem="vEs-cy-DNe" secondAttribute="leading" constant="15" id="ji2-jC-ALH"/>
</constraints>
<nil key="simulatedTopBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<viewLayoutGuide key="safeArea" id="BTY-Ub-l0q"/>
<connections>
<outlet property="titleLabel" destination="EcM-2G-Fff" id="b52-bJ-ec2"/>
</connections>
Expand Down
2 changes: 1 addition & 1 deletion ExampleApp/Table Example/TableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class ArticleAdapter: TableAdapter<Article,TableArticleCell> {
ctx.cell?.subtitleLabel?.text = ctx.model.text
}
self.on.tap = { ctx in
ctx.cell?.accessoryType = UITableViewCell.AccessoryType.checkmark
ctx.cell?.accessoryType = UITableViewCellAccessoryType.checkmark
print("Tapped on article \(ctx.model.modelID)")
return .deselectAnimated
}
Expand Down
4 changes: 2 additions & 2 deletions FlowKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Configs/FlowKit.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
ONLY_ACTIVE_ARCH = NO;
PRODUCT_BUNDLE_IDENTIFIER = "com.FlowKit.FlowKit-iOS";
Expand All @@ -693,7 +693,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = Configs/FlowKit.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.FlowKit.FlowKit-iOS";
PRODUCT_NAME = FlowKit;
Expand Down
2 changes: 1 addition & 1 deletion FlowKitManager.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Pod::Spec.new do |s|
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "Daniele Margutti" => "me@danielemargutti.com" }
s.social_media_url = "https://twitter.com/danielemargutti"
s.ios.deployment_target = "9.0"
s.ios.deployment_target = "8.0"
s.source = { :git => "https://github.com/malcommac/FlowKit.git", :tag => s.version.to_s }
s.source_files = "Sources/**/*"
s.frameworks = "Foundation"
Expand Down
16 changes: 14 additions & 2 deletions Sources/FlowKit/Collection/CollectionAdapter+Events.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,20 @@ public extension CollectionDirector {
var layoutDidChange: ((_ old: UICollectionViewLayout, _ new: UICollectionViewLayout) -> UICollectionViewTransitionLayout?)? = nil
var targetOffset: ((_ proposedContentOffset: CGPoint) -> CGPoint)? = nil
var moveItemPath: ((_ originalIndexPath: IndexPath, _ proposedIndexPath: IndexPath) -> IndexPath)? = nil
var shouldUpdateFocus: ((_ context: UICollectionViewFocusUpdateContext) -> Bool)? = nil
var didUpdateFocus: ((_ context: UICollectionViewFocusUpdateContext, _ coordinator: UIFocusAnimationCoordinator) -> Void)? = nil

private var _shouldUpdateFocus: ((_ context: AnyObject) -> Bool)? = nil
@available(iOS 9.0, *)
var shouldUpdateFocus: ((_ context: UICollectionViewFocusUpdateContext) -> Bool)? {
get { return _shouldUpdateFocus }
set { _shouldUpdateFocus = newValue as? ((AnyObject) -> Bool) }
}

private var _didUpdateFocus: ((_ context: AnyObject, _ coordinator: AnyObject) -> Void)? = nil
@available(iOS 9.0, *)
var didUpdateFocus: ((_ context: UICollectionViewFocusUpdateContext, _ coordinator: UIFocusAnimationCoordinator) -> Void)? {
get { return _didUpdateFocus }
set { _didUpdateFocus = newValue as? ((AnyObject, AnyObject) -> Void) }
}

var willDisplayHeader : ((HeaderFooterEvent) -> Void)? = nil
var willDisplayFooter : ((HeaderFooterEvent) -> Void)? = nil
Expand Down
2 changes: 2 additions & 0 deletions Sources/FlowKit/Collection/CollectionDirector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -485,13 +485,15 @@ public extension CollectionDirector {
return ((adapter.dispatch(.shouldSpringLoad, context: InternalContext.init(model, indexPath, nil, collectionView)) as? Bool) ?? true)
}

@available(iOS 9.0, *)
public func collectionView(_ collectionView: UICollectionView, shouldUpdateFocusIn context: UICollectionViewFocusUpdateContext) -> Bool {
guard let update = self.on.shouldUpdateFocus?(context) else {
return true
}
return update
}

@available(iOS 9.0, *)
public func collectionView(_ collectionView: UICollectionView, didUpdateFocusIn context: UICollectionViewFocusUpdateContext, with coordinator: UIFocusAnimationCoordinator) {
self.on.didUpdateFocus?(context,coordinator)
}
Expand Down
2 changes: 2 additions & 0 deletions Sources/FlowKit/Collection/FlowCollectionDirector.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ open class FlowCollectionDirector: CollectionDirector, UICollectionViewDelegateF
/// Each new header view that scrolls to the top of the screen pushes the previously pinned header view offscreen.
///
/// The default value of this property is `false`.
@available(iOS 9.0, *)
public var stickyHeaders: Bool {
set { self.layout?.sectionHeadersPinToVisibleBounds = newValue }
get { return (self.layout?.sectionHeadersPinToVisibleBounds ?? false) }
Expand All @@ -71,6 +72,7 @@ open class FlowCollectionDirector: CollectionDirector, UICollectionViewDelegateF
/// Each new footer view that scrolls to the bottom of the screen pushes the previously pinned footer view offscreen.
///
/// The default value of this property is `false`.
@available(iOS 9.0, *)
public var stickyFooters: Bool {
set { self.layout?.sectionFootersPinToVisibleBounds = newValue }
get { return (self.layout?.sectionFootersPinToVisibleBounds ?? false) }
Expand Down