Skip to content

Add icon to left or right of the cell.#30

Open
Tchelow wants to merge 1 commit into
AssistoLab:masterfrom
Tchelow:feature/add-icon-suggestion
Open

Add icon to left or right of the cell.#30
Tchelow wants to merge 1 commit into
AssistoLab:masterfrom
Tchelow:feature/add-icon-suggestion

Conversation

@Tchelow

@Tchelow Tchelow commented Jul 26, 2016

Copy link
Copy Markdown

This is a suggestion on how we could have a left or right icon along with the title of the cell.
Obviously, instead of using a public var icon: UIImage? we should add it to the dataSource and adapt it to handle not only an array of Strings but multiple objects.
Feel free to change and adapt it in order to conform with everything else and put it to good use. I'd finish it, but I'm running short on time.

This PR refers to the issue #29.

@kevin-hirsch

Copy link
Copy Markdown
Collaborator

Hello @Tchelow,

It is indeed a good idea 👍
As you said, the icons should be included in the dataSource via an object instead of a String.
I will work on that when I have time.
I would make dataSource items objects that conform to StringLiteralConvertible, so it could be backward compatible.

struct DropDownChoice: StringLiteralConvertible {

   let text: String
   let icon: UIImage?

   // Basic init method and StringLiteralConvertible init

}

let dropDown = DropDown()

// dataSource is an Array of DropDownChoice's

// can be used like this
dropDown.dataSource = ["simple text", "with", "no icons"]
// or like this
dropDown.dataSource = [
   DropDownChoice(text: "text", icon: UIImage(named: "icon_1"), 
   DropDownChoice(text: "with", icon: UIImage(named: "icon_2"),
   DropDownChoice(text: "icons", icon: UIImage(named: "icon_3")
]

@kevin-hirsch kevin-hirsch self-assigned this Aug 29, 2016
@kevin-hirsch kevin-hirsch added this to the 1.1 milestone Aug 29, 2016
@Tchelow

Tchelow commented Sep 2, 2016

Copy link
Copy Markdown
Author

Hi Kevin,
It's a good idea to make it backward compatible.
If I have time before you do, I'll try to finish it, but schedule is not looking promising 😂

@kevin-hirsch

Copy link
Copy Markdown
Collaborator

Hello @Tchelow,

Don't worry, if you don't have time I'll implement it, plus, I'm actually implementing #27 which is gonna change a lot the code (also for the dataSource) so it may be easier to wait for it to be done and then implement this feature :)

By the way, if you have a screenshot of your app using the DropDown, I'm curious! 😄

@Tchelow

Tchelow commented Sep 12, 2016

Copy link
Copy Markdown
Author

I sent you an email with the screenshot.
And I'll wait for #27 then. :)

@carlosen14

Copy link
Copy Markdown

is this working in swift 3.0 (master branch) ?

@Luccifer

Copy link
Copy Markdown

@carlosen14 looks like not

@iHamzaaK

Copy link
Copy Markdown

any update on this enhancement?

@kevin-hirsch kevin-hirsch removed this from the 2.1 milestone Nov 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants