Skip to content
This repository has been archived by the owner on Mar 7, 2021. It is now read-only.

Segmented Control / Switch Field #544

Merged
merged 9 commits into from
Oct 18, 2016
Merged

Conversation

jeffleeismyhero
Copy link
Collaborator

@jeffleeismyhero jeffleeismyhero commented Oct 10, 2016

This adds the functionality requested in the Feature Request Issue #536. It might also work for the functionality requested in issues #474 and #476.

Field type: segment
Values: This field takes values in the same format as select fields.

Example JSON

[
  {
    "id": "group",
    "title": "Group",
    "sections": [
      {
        "id": "section",
        "fields": [
          {
            "id": "segment",
            "title": "Location",
            "type": "segment",
            "values":[
              {
                "id":"in_house",
                "title":"In-house",
                "default":true
              },
              {
                "id":"remote",
                "title":"Remote"
              }
            ],
            "size": {
              "width": 40,
              "height": 1
            }
          }
        ]
      }
    ]
  }
]

@jeffleeismyhero jeffleeismyhero changed the title [WIP] Segmented Control / Switch Field Segmented Control / Switch Field Oct 10, 2016
@jeffleeismyhero
Copy link
Collaborator Author

Below is a screenshot of the segment field with default styling.

screen shot 2016-10-10 at 3 56 35 pm

This is the field with modified font styling:

screen shot 2016-10-10 at 3 54 56 pm

@3lvis
Copy link
Owner

3lvis commented Oct 10, 2016

Looking good, @jeffleeismyhero :)

@3lvis 3lvis changed the base branch from master to switches October 18, 2016 19:07
"id": "segment",
"title": "My Segment",
"type": "segment",
"value": "part_1",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? I was hoping that maybe we could only get the value from the default values field, otherwise we'll keep it as nil.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wasn't needed. :)

hyperoslo@e56a5bd

@3lvis 3lvis merged commit 3a8f7d8 into 3lvis:switches Oct 18, 2016
@3lvis
Copy link
Owner

3lvis commented Oct 18, 2016

Merging to switches branch. Gonna have a look there why the extra value is needed.

3lvis added a commit that referenced this pull request Oct 18, 2016
* Segmented Control / Switch Field (#544)

* Add support for Accessibility Labels on text field

* Add accessibility label support to other fields

This also sets the accessibility value for date, time, and select fields to the selected value. Text fields automatically behave this way.

* Add documentation for Accessibility Labels

* Correct Markdown syntax for links

* Add UISegmentedControl support

* Add tests for Segment Control

* Update README and STYLING documents for Segments

* Update project

* Remove the need for setting the value on the segmented field
3lvis added a commit that referenced this pull request Oct 18, 2016
* Segmented Control / Switch Field (#544)

* Add support for Accessibility Labels on text field

* Add accessibility label support to other fields

This also sets the accessibility value for date, time, and select fields to the selected value. Text fields automatically behave this way.

* Add documentation for Accessibility Labels

* Correct Markdown syntax for links

* Add UISegmentedControl support

* Add tests for Segment Control

* Update README and STYLING documents for Segments

* Update project

* Remove the need for setting the value on the segmented field

* Update Basic-Swift project to Swift 3
@3lvis
Copy link
Owner

3lvis commented Oct 18, 2016

👏 Fantastic job, @jeffleeismyhero 👏

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants