mirror of
https://github.com/material-components/material-components-ios.git
synced 2026-01-15 17:22:23 +08:00
This PR adds an experimental `UITextField` subclass called `SimpleTextField` and accompanying examples to the `MaterialComponentExamples` (i.e. not `MaterialComponents` or `MaterialComponentsAlpha`) pod. The ultimate aim of this text field is to complement (not replace) `MDCTextField` by: - Providing an alternative when ongoing and difficult to fix `MDCTextField` bugs are blockers for clients/potential clients. - Providing an alternative for clients who prefer not to work with `MDCTextInputControllers` due to perceived overhead. - Hopefully doing two things (being a simple or filled text field) very well, rather than trying to do the many things `MDCTextField` and its related classes do. Things I'm still thinking about/working on: - VoiceOver. I haven't thought about VoiceOver at all yet. It would be nice to be able to just do what super would do and append the underline labels' and side views' accessibilityLabels/Values to that. - Should it have some kind of input chip functionality? I'd say this is doable, but would require some thinking. - Text field density support - The spec mentions "high-density" text fields--this refers to text fields whose bounds fit more snugly around the text, etc. My best idea for achieving this involves a `CGFloat` property called `desiredMainContentHeight`. "Main content height" refers to the area of the text field that contains the text, left/right view, placeholder, clear button, etc. Basically everything but the underline labels. With this property set to 0 (the default) the text field layout would be determined as it is right now. If set to anything other than that, the layout calculation would use the assigned value for the main area height, rather than the value it calculates. - The manual layout example has some scroll view weirdness that I haven't had time to really fix yet. Also, the Swift storyboard example is basically useless because I can't refer to `SimpleTextField`, an Objective-C class in the same module, from it. I haven't had time to figure this out yet. - It would be cool if some of the properties supported IBDesignable. I don't know IBDesignable that well, but I think doing this might make it so that you could specify outlined or filled in the storyboard and not have to write any code to achieve either style. - This isn't code related, but I want to move away from this "Utils" file. It's a catch-all for things that could be more thoughtfully structured. The file structure in general really needs some work. - There are no tests! Feel free to look at the examples! "Simple Text Field (Manual Layout)" is better than "Simple Text Field (Storyboard)" right now. Here's an LTR video:  And an RTL video: 
34 lines
1.7 KiB
Ruby
34 lines
1.7 KiB
Ruby
experimental_sources = [
|
|
'components/*/examples/experimental/supplemental/*.{h,m,swift}',
|
|
'components/*/examples/experimental/*.{h,m,swift}',
|
|
]
|
|
|
|
experimental_headers = [
|
|
'components/*/examples/experimental/supplemental/*.h',
|
|
'components/*/examples/experimental/*.h',
|
|
]
|
|
|
|
experimental_resources = [
|
|
'components/*/examples/experimental/resources/*'
|
|
]
|
|
|
|
|
|
Pod::Spec.new do |s|
|
|
s.name = "MaterialComponentsExamples"
|
|
s.version = "72.2.0"
|
|
s.authors = "The Material Components authors."
|
|
s.summary = "This spec is an aggregate of all the Material Components examples."
|
|
s.description = "This spec is made for use in the MDC Catalog. Used in conjunction with CatalogByConvention we create our Material Catalog."
|
|
s.homepage = "https://github.com/material-components/material-components-ios"
|
|
s.license = 'Apache 2.0'
|
|
s.source = { :git => "https://github.com/material-components/material-components-ios.git", :tag => "v#{s.version}" }
|
|
s.platform = :ios, '8.0'
|
|
s.requires_arc = true
|
|
s.source_files = experimental_sources + ['components/*/examples/*.{h,m,swift}', 'components/*/examples/supplemental/*.{h,m,swift}', 'components/private/*/examples/*.{h,m,swift}', 'components/schemes/*/examples/*.{h,m,swift}', 'components/schemes/*/examples/supplemental/*.{h,m,swift}']
|
|
|
|
s.resources = experimental_resources + ['components/*/examples/resources/*', 'components/private/*/examples/resources/*', 'components/schemes/*/examples/resources/*']
|
|
s.dependency 'MaterialComponents'
|
|
s.dependency 'MaterialComponentsBeta'
|
|
s.public_header_files = experimental_headers + ['components/*/examples/*.h', 'components/*/examples/supplemental/*.h', 'components/private/*/examples/*.h', 'components/schemes/*/examples/*.h']
|
|
end
|