wayfair-archive / brickkit-ios

DEPRECATED - BrickKit For IOS
Apache License 2.0
605 stars 57 forks source link

Support for Drag and Drop #190

Closed aaronsky closed 5 years ago

aaronsky commented 7 years ago

This pull request is a Work In Progress and should not be merged until otherwise noted!!

This PR introduces drag and drop support to BrickKit.

Bricks that should be considered eligible for drag and/or drop should provide a delegate for Brick#dragDropDelegate. To opt-in to drag, return a [UIDragItem] in BrickDragDropDelegate#dragItems(for:at:). To opt-in to drop, return a Bool in BrickDragDropDelegate#canHandle(_:) affirming whether the provided UIDropSession has any objects that conform to your brick's supported UTIs, and implement the BrickDragDropDelegate#willDrop(_) and BrickDragDropDelegate#drop(_:to:from:) handlers. For more information, see the DragDropBrickViewController example, as well as Apple's documentation on Drag and Drop in Collection Views.

I have put this PR up here despite its state of completion to kickstart discussion about this feature, as well as provide advice on how BrickLayouts work.

Current list of to-dos:

codecov-io commented 7 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@f3cb712). Click here to learn what that means. The diff coverage is 2.3%.

Impacted file tree graph

@@           Coverage Diff            @@
##             master    #190   +/-   ##
========================================
  Coverage          ?   89.6%           
========================================
  Files             ?      41           
  Lines             ?    4626           
  Branches          ?     362           
========================================
  Hits              ?    4145           
  Misses            ?     480           
  Partials          ?       1
Impacted Files Coverage Δ
Source/Cells/BrickCell.swift 98.67% <ø> (ø)
Source/Layout/BrickZIndexer.swift 100% <ø> (ø)
Source/Layout/BrickFlowLayout.swift 91.18% <ø> (ø)
Source/Cells/ImageDownloader.swift 79.31% <ø> (ø)
Source/Models/BrickSection.swift 85.86% <0%> (ø)
Source/Cells/BrickPlaceholderCell.swift 0% <0%> (ø)
Source/Models/Brick.swift 71.23% <0%> (ø)
...ViewControllers/BrickViewController+DragDrop.swift 0% <0%> (ø)
Source/ViewControllers/BrickViewController.swift 86.11% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f3cb712...009da3e. Read the comment docs.

aaronsky commented 7 years ago

Before this PR can be merged in, I suspect that BrickKit is going to need to drop support for building against the iOS 10.3 SDK and lower. Otherwise, Travis builds will continue to fail and codecov won't be able to get usable data to work with. This is not the same as dropping support for iOS 9 and 10, we just need to make sure we're only building against the iOS 11.0 SDK or later.