-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Playground examples #134
Playground examples #134
Conversation
Codecov Report
@@ Coverage Diff @@
## master #134 +/- ##
=======================================
Coverage 93.25% 93.25%
=======================================
Files 38 38
Lines 3097 3097
=======================================
Hits 2888 2888
Misses 209 209 Continue to review full report at Codecov.
|
@@ -1,6 +1,16 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<Workspace | |||
version = "1.0"> | |||
<Group | |||
location = "group:Example/Playgrounds" | |||
name = "Playgrounds"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this group to the bottom in the workspace
|
||
let name: String | ||
|
||
init(name: String) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this is a struct, you won't need a dedicated init
import PlaygroundSupport | ||
|
||
|
||
struct Fruit { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can "hide" structs and classes in a playground, so you don't really clutter the code
} | ||
|
||
class RepeatCount: BrickRepeatCountDataSource { | ||
func repeatCount(for identifier: String, with collectionIndex: Int, collectionIdentifier: String) -> Int { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also set repeatCount
directly on the brick to make it simpler
} | ||
} | ||
|
||
let brickViewContoller = BrickViewController() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use BrickCollectionView
, so the frame can be set
LabelBrick("FRUIT", dataSource: labelDataSource) | ||
], inset: 8, edgeInsets: UIEdgeInsets(top: 8, left: 16, bottom: 8, right: 16)) | ||
|
||
section.repeatCountDataSource = repeatCount |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use repeatCount
directly on the Brick
let repeatCount = RepeatCount() | ||
|
||
let section = BrickSection(backgroundColor: .lightGray, bricks: [ | ||
LabelBrick("FRUIT", dataSource: labelDataSource) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use GenericBrick<UILabel>
as this is the preferred method from now on
e398c87
to
4f3d187
Compare
[skip ci]
Closes #133