116 Commits

Author SHA1 Message Date
Dave MacLachlan
ebac2a8eb7 As of iOS 9/macOS 10.11 (circa 2015) removing objective C objects from the NSNotificationCenter in - (void)dealloc. is no longer required (the classic example is: [[NSNotificationCenter defaultCenter] removeObserver:self] but there are several variations).
In many cases this is the only thing being done in - (void)dealloc, so we can remove the whole thing.

PiperOrigin-RevId: 307663440
2020-04-21 13:00:30 -07:00
Cody Weaver
3b3d288ea4
[TextFields] Add theming extension for underline controller (#9437)
In #9109  we removed the color themer for the underline controller. This change closes #9371  which will allow clients to theme their underline controller text fields via a theming extension. This change will theme both color and typography.

*Note* [Material](material.io) recommends using a [filled or outlined text field](https://material.io/components/text-fields/).

| Resting | Active |
| --- | --- |
|![Simulator Screen Shot - iPhone 8 Plus - 2020-01-16 at 13 13 28](https://user-images.githubusercontent.com/7131294/72563237-1811ed80-3862-11ea-8788-816c927f03e4.png)|![Simulator Screen Shot - iPhone 8 Plus - 2020-01-16 at 13 13 26](https://user-images.githubusercontent.com/7131294/72563252-1cd6a180-3862-11ea-97c9-6d7c82f6878d.png)|

Closes #9371 
Closes #9242
2020-01-16 14:20:09 -08:00
Andrew Overton
4c75e862d4
[TextFields] Don't use MDCTextFieldTypographyThemer (#9170)
Related to #9168
2019-12-09 10:13:34 -05:00
Wenyu Zhang
593cf1e621 Revert "[TextFields] Check if placeholder is hidden before verbalizing it in voice over. (#8804)"
This reverts commit f9c17caf1bffd8e4538ee2c587d780e55437243c.
2019-11-22 10:56:15 -05:00
Randall Li
f9c17caf1b
[TextFields] Check if placeholder is hidden before verbalizing it in voice over. (#8804)
[TextFields] Add check for placeholder before adding to the accessibility strings spoken by voice over.

Also added changed example to remove the floating label so that we can check that voice over correctly verbalizes only the visible text.

Before and After zip:
[BeforeAfterVideos.zip](https://github.com/material-components/material-components-ios/files/3843558/BeforeAfterVideos.zip)

QA=Notice that "state" is verbalized when it is not visible on screen in the after.
more info at #7513
2019-11-15 12:21:40 -05:00
Andrew Overton
02f9c9f01d
Move new TextFields into TextControls directory (#8726)
In this PR I extract the new TextFields from the old TextFields directory. In the future, if we bring over the input chip view and text area, they will go under this new TextControls directory as well.

Closes #8684.
2019-11-07 14:17:56 -05:00
Andrew Overton
cfc699b199
[TextFields] Add outlined textfield (#8705)
This PR adds the outlined textfields. The snapshots look a little weird because the way the snapshot tests are currently implemented they only get an image that's as big as the frame of the view. In a follow up PR I'm going to change that, so the images will have the entire floating label (which goes above the top of the view) for example.

![textfield-example](https://user-images.githubusercontent.com/8020010/67978102-ba212280-fbef-11e9-8802-7a0b230f900a.gif)


Closes #6942.
2019-11-01 16:23:55 -04:00
Andrew Overton
f2e5fe4fbd
Add filled textfields (#8674)
This PR adds MDCFilledTextField, updates the example to include it, and adds some unit tests for MDCFilledTextField's public API. I will add snapshot tests to this PR after #8670 is merged in.

Related to #6942.
2019-10-31 12:50:35 -04:00
Andrew Overton
9d814f27fc
[TextFields] Bring more of base positioning reference over (#8530)
This PR brings more of the MDCTextControlVerticalPositioningReferenceBase over. The positioning reference objects provide information about the vertical positioning of subviews in MDCTextControls. Each MDCTextControlStyle vends a different positioning reference object to be used by the layout object.

It is important to remember that this PR does not bring over everything the positioning reference object does. Things like MDCTextControl density (dense textfields are textfields that are squished vertically so more textfields can be shown using less space) are made possible with this object.

Related to #6942.
2019-10-01 15:02:12 -04:00
Andrew Overton
6febfa95cf
[TextFields] Add some placeholder logic (#8448)
This PR adds some placeholder support to MDCBaseTextField.

MDCBaseTextField has some special considerations related to placeholder visibility tthat UITextField does not have due to the fact that the label can sometimes occupy the space where the placeholder goes when there is no text.

Here's a screenshot of an MDCBaseTextField with a placeholder:
<img width="363" alt="Screen Shot 2019-09-26 at 11 03 09 AM" src="https://user-images.githubusercontent.com/8020010/65700251-4ec2be80-e04d-11e9-93ab-a75a60c88ada.png">

Related to #6942.
2019-09-26 12:48:22 -04:00
Andrew Overton
1fbb91217f
[TextFields] Add label animator (#8382)
This PR adds the class that animates the textfield's label. Part of #6942.

One thing I noticed: the label's animation to the floating position (but not from it) doesn't seem to work on simulators running iOS 9, 10, or 11. It works on simulators running iOS 13 simulators though. It also works on @romoore's iPhone 4s device running iOS ~9.3 or so. I think it's just a simulator issue. Still, a little unsettling... 

Here's a gif of the animation:
![label_animation](https://user-images.githubusercontent.com/8020010/64048558-0b555d00-cb40-11e9-87f5-0c6aa2c7fbb2.gif)
2019-09-06 10:00:32 -04:00
Andrew Overton
ab4f218a09
[TextFields] Add contained input view clear button (#8247)
This PR brings the Contained Input View clear button over to the skeleton MDCBaseTextField.

Related to #6942.

Here's a gif:
![clearbutton](https://user-images.githubusercontent.com/8020010/63624977-371a9500-c5cc-11e9-9825-1e6d30b28686.gif)
2019-08-30 09:52:37 -04:00
Andrew Overton
70daa8f70d
[TextFields] Add floating label to MDCBaseTextField (#8358)
This PR brings over a very rudimentary version of floating label support for contained input view based textfields. A lot of this stuff is going to be replaced by other stuff when the time is right. 
Part of #6942.

Here's a gif:
![FloatingLabel](https://user-images.githubusercontent.com/8020010/63528277-a9a64a80-c4d0-11e9-82a8-1bb78b39fc5f.gif)
2019-08-22 15:22:13 -04:00
Andrew Overton
fecd909263
Delete experimental textfields (#8317)
I opened #8231 in the spirit of keeping the experimental textfields up to date in our repo, but I think I'm going to take a different approach. Now that I'm actually bringing things over I'm encountering collisions with file names--there can't be an MDCContainedInputView.h in experimental examples and component source. And it's not worth adding a "2" suffix to every file in the experimental directory. So I'm going to delete all the experimental stuff!

Further development will take place in a local branch where the ContainedInputView textfields live in MaterialTextFields+ContainedInputView.
2019-08-15 10:14:20 -04:00
Robert Moore
f14a71f02f
[TextFields] Remove use of NS_ASSUME_NONNULL_BEGIN. (#8301)
The project overwhelmingly uses explicit nullability annotations. This PR
switches experimental code to using explicit nullability.

Part of #8297
2019-08-13 12:52:02 -04:00
Andrew Overton
59f5551313
[TextFields] Add non-experimental MDCBaseTextField example (#8287)
This PR adds a non-experimental MDCBaseTextField example.

Related to #6942.

Here are some screenshots:
![Simulator Screen Shot - iPhone 7 - 2019-08-12 at 13 56 25](https://user-images.githubusercontent.com/8020010/62886361-22efb180-bd09-11e9-97ff-7a82dd1f8af3.png)
![Simulator Screen Shot - iPhone 7 - 2019-08-12 at 13 56 23](https://user-images.githubusercontent.com/8020010/62886362-22efb180-bd09-11e9-9814-d5da6584babf.png)
2019-08-12 15:27:21 -04:00
Robert Moore
ff2d8a4e7f
[*] Drop iOS 9 guards for Swift. (#8001)
Drops some iOS 9 checks in Swift code.

Part of #2651
2019-07-23 12:23:28 -04:00
Robert Moore
14ab9ae9e5
[TextFields] Remove iOS 9 guards. (#8000)
Part of #2651
2019-07-23 12:23:02 -04:00
featherless
19a35ce6ee
[TextFields] Resolve some swift warnings. (#7529)
Doing this as part of exploring the new features and functionality of Xcode 11.0 beta 1.
2019-06-03 23:27:23 -04:00
Robert Moore
97ebc0ce0b
[TextFields] Make Kitchen Sink better for tests. (#7259)
Adding "validation" to make it easier to test error states in the
Kitchen Sink example.

Preparation for #7157
2019-04-23 23:02:10 -04:00
Robert Moore
62cca706ae
[TextFields] Fix Contained example error states. (#7252)
Fixing the error logic of the Contained Text Fields example. This makes it
easier to debug issues around the error state and UIAccessibility.  Specifically, this clears the error state for some of the text fields that would "hang around" in the following conditions:

1.  The user places the Text Field in an "error state" by entering invalid text.
2.  The user changes the focus from the error-state Text Field to another
3.  The user then either:
    1.  Returns focus to that error-state Text Field and corrects the error and uses the "Return" button to resign first responder on the text field
     2. Presses the Text Field's clear button to remove the offending content.

In both cases, the error state incorrectly "stuck around" even though the content did not warrant that state.

| |Precondition|Result|
|---|---|---|
|Before|![outlined-error-content-before](https://user-images.githubusercontent.com/1753199/56605451-31875100-65d2-11e9-87ef-f0d069fa8114.png)|![outlined-error-cleared-before](https://user-images.githubusercontent.com/1753199/56604064-20891080-65cf-11e9-9348-fbfc9201b765.png)
|After|![outlined-error-content-before](https://user-images.githubusercontent.com/1753199/56605451-31875100-65d2-11e9-87ef-f0d069fa8114.png)|![outlined-error-cleared-after](https://user-images.githubusercontent.com/1753199/56604071-241c9780-65cf-11e9-997e-24bcfa35b13e.png)|

Prework for #7157
2019-04-23 14:15:59 -04:00
Robert Moore
b59abd2dd7 [TextFields] Fix example layout. (#7251)
Fixing more example layouts so that the text fields are visible below the
AppBar.

|Before|After|
|---|---|
|![customfont-before](https://user-images.githubusercontent.com/1753199/56601838-27615480-65ca-11e9-85e0-57452e41293d.png)|![customfont-after](https://user-images.githubusercontent.com/1753199/56601846-2b8d7200-65ca-11e9-9571-db1f408a83ed.png)|
|![kitchensink-before](https://user-images.githubusercontent.com/1753199/56601858-2f20f900-65ca-11e9-9abb-84188cbe36bb.png)|![kitchensink-after](https://user-images.githubusercontent.com/1753199/56601882-3ba55180-65ca-11e9-8bd8-10e5ede0bab2.png)|
|![outlinedswift-before](https://user-images.githubusercontent.com/1753199/56601891-41029c00-65ca-11e9-8306-6aa1caf4b221.png)|![outlinedswift-after](https://user-images.githubusercontent.com/1753199/56601910-4b249a80-65ca-11e9-950e-674fc54caebd.png)|

Preparation for #7157
2019-04-23 14:09:45 -04:00
Robert Moore
0c317f190d
[TextFields] Fix examples layout (#7250)
Fixing the examples layout so the content doesn't overlap the App Bar.

|Before|After|
|---|---|
|![legacy-multi-before](https://user-images.githubusercontent.com/1753199/56600236-3ba35280-65c6-11e9-9276-52acb5cde63b.png)|![legacy-multi-after](https://user-images.githubusercontent.com/1753199/56600242-3f36d980-65c6-11e9-8faf-bc5255bf3bdb.png)|
|![outlined-before](https://user-images.githubusercontent.com/1753199/56600248-42ca6080-65c6-11e9-911f-2cd9828dfb62.png)|![outlined-after](https://user-images.githubusercontent.com/1753199/56600262-49f16e80-65c6-11e9-9775-95d452fec723.png)|
|![controller-styles-before](https://user-images.githubusercontent.com/1753199/56600269-4e1d8c00-65c6-11e9-9359-8e98f0e1cbc1.png)|![controller-styles-after](https://user-images.githubusercontent.com/1753199/56600290-57a6f400-65c6-11e9-9d8f-8f9ac2c243be.png)|

Preparation for #7157
2019-04-23 14:05:34 -04:00
Yarden Eitan
efe61588a6
update (#7246)
We need to add @objc annotations to colorScheme and typographyScheme instances in our Swift examples, because we moved to Swift 4.2, the respondsToSelector won't find `setColorScheme:` and `setTypographyScheme:` setters otherwise.
2019-04-23 10:21:14 -04:00
Andrew Overton
c56d5d76d3
Add @objc annotations to get examples to show up in Dragons (#7168)
This is a follow up PR for #7166 adds @objc annotations to Swift catalogMetadata() methods, because the Swift 4 compiler no longer attempts to infer what methods should be visible to Objective-C. As a result of this change in the compiler, no Swift examples were showing up in Dragons after #7166. See this article: https://useyourloaf.com/blog/objc-warnings-upgrading-to-swift-4/ for additional context.
2019-04-17 21:35:43 -04:00
Andrew Overton
b38372192f
Update to Swift 4.2 (#7166)
This PR updates the Swift version to 4.2.

Partially resolves #6874.
2019-04-17 16:59:02 -04:00
Andrew Overton
c924f58054
[TextFields] Create concrete MDCFilledTextField and MDCOutlinedTextField classes based on the Contained Input View architecture (#7144)
In this PR I have created MDCFilledTextField and MDCOutlinedTextField concrete classes that inherit from an MDCInputTextField base class. There are no significant changes to how the text fields work under the hood--they are still contained input views. However, that protocol conformance is now private. If we were to include these classes in our library clients would not need to have any idea what a Contained Input View is. For discussion on the rationale for doing this see the ill-fated https://github.com/material-components/material-components-ios/pull/6985 and [b/130306935](http://b/130306935).
 
Closes #7111.
2019-04-16 13:12:47 -04:00
Andrew Overton
41428ef329
[TextFields] Updates to MDCContainedInputView and SimpleTextField (#6904)
* Refactor simple text field manual layout example code

* Make clear button layout calculation more understandable

* Have density informer protocol provide floating font scale factor instead of floating font size

* Send editingChanged event when clearing text

* Extract some placeholder management into a common object

* Run clang format

* Add WIP fancy animations to filled style

* In the middle of dealing with vertical density

* ITF vertical density is in a good place at the expense of ICV vertical density

* Run clang format

* Update input chip view density and example

* Add dynamic type support

* Ran clang format

* remove dead code

* Add a density informer method for the padding around the toprow/bottomrow divider

* Refactor placeholder animation code

* Ran clang format

* Refactor some placeholder layout logic

* Add nullability annotations

* Add missing nullability annotation

* Get rid of framework import for now

* Cast CAAnimation to CABasicAnimation

* Rename containerRect to containerFrame

* A bunch of property, class, and file renamings

* beginning to split floating label and placeholder. also some renamings

* Ran clang format

* More renamings

* More renamings

* Ran clang format

* A ton of renamings, some of which may need a second look ...

* More work separating floating label and placeholder

* Ran clang format

* About to make placeholder a UILabel again :(

* Placeholder and floating label are behaving pretty well together

* Fix placeholder appearance in text field

* Get rid of unneeded method

* Added some docs and got rid of the density informer method for bottom padding

* Get rid of some dead code

* Ran clang format

* Add nullability annotation

* Add CGFloat cast

* Renamed some things

* Positioning delegates no longer inherit from a root class, and they are passed into style object initializers
2019-04-11 15:12:30 -04:00
featherless
f17b01c584
Enable -Wunguarded-availability. (#6776)
### Context

By default, Objective-C code will only perform availability checks for iOS APIs introduced from iOS 11 and up. We can enable -Wunguarded-availability to turn on available checks for older SDKs.

Additional context for this behavior comes from [llvm](https://reviews.llvm.org/D34264);

> [This patch](https://reviews.llvm.org/D34264) adds a new warning flag called -Wunguarded-availability-new. If -Wunguarded-availability is off, this warning only warns about uses of APIs that have been introduced in macOS >= 10.13, iOS >= 11, watchOS >= 4 and tvOS >= 11. This warning is on by default. We decided to use this kind of solution as we didn't want to turn on -Wunguarded-availability by default, as we didn't want our users to get warnings about uses of old APIs in their existing projects.

### What's happening in this change

This change turns on -Wunguarded-availability. This has the effect of the compiler performing availability checks for all APIs at or above the current deployment target (iOS 8.0). As such, this PR addresses several instances of code that were not performing availability checks.

Going forward, we will be able to use availability to encode our supported SDKs into the APIs that we provide. For example, we could annotate MDCActivityIndicator with NS_AVAILABLE_IOS(9_0) and all of our code would then have to use runtime checks prior to using this API.

### Caveats

Because -Wunguarded-availability is not enabled by default in Objective-C, our clients will need to proactively enable this flag in order to be warned of any use of APIs that support OS versions < 11.0. We can mitigate this risk in two ways:

1. Clearly announce any changes in our supported OS versions.
2. Encourage clients to enable -Wunguarded-availability.
2019-03-08 10:01:17 -05:00
Andrew Overton
1d7fedd32d
[TextFields] Updates to SimpleTextFIeld and InputChipView prototype (#6647)
[TextFields] Updates to SimpleTextFIeld and InputChipView prototype

This PR contains a lot of updates to SimpleTextField. Some of these updates are for little things I noticed I got wrong after looking at the guidelines a bit more. The more substantial changes introduced here, however, are related to feedback given in the design doc overview meeting in January. As a reminder, the two takeaways from that meeting were:

1. SimpleTextField shouldn't depend on MDCContainerScheme
2. The styles should not be represented as enum cases. Instead, they should be objects.

These changes address those pieces of feedback. While I still need to get around to updating the design doc to reflect the changes, I don't see the harm in merging the updates into their home in a MaterialComponentsExamples experimental directory.

This PR also contains changes that are not directly related to SimpleTextField!

Late last year, when we had the week of free time to do whatever we wanted, I began thinking about incorporating chips into SimpleTextFields. Not far into it I decided that any view implementing input chip functionality should be its own view, i.e. it shouldn't be stuffed in a UITextField, which carries inheritance-related burden. I started work on such a view in January, and briefly used it during the SimpleTextField design doc overview meeting to demonstrate how SimpleTextField styling could be generalized across views.

Following that meeting, and following the refactoring work to address feedback on SimpleTextFields, I updated the InputChipView to see how extensible my "container style as object" approach was. I think the work here, while definitely not a finished product, demonstrates that it's fairly usable. MDCSimpleTextField (I added an MDC) and InputChipView (no MDC) both conform to a protocol called MDCContainedInputView. That protocol declares a property for objects conforming to MDCContainerStyling. There are a few other classes and protocols in there, but I will write or talk more about those in a different setting. The key here is that I think it all might work, based off these changes. There are still some loose ends, but they can be taken care of. They _will_ be taken care of if the team decides to take this direction. They maybe won't if we decide to continue investing in MDCTextFields for all of our user input needs. If we do end up deciding to bring all this into the codebase I want the next addition to this family of contained input views to be a subclass of UITextView, for multiline text input.

This gif shows the updated MDCSimpleTextField styled as an "outlined" text field:
![stf_outlined_2](https://user-images.githubusercontent.com/8020010/53023951-2a09c700-342c-11e9-88df-9605d652c46c.gif)
This gif shows the updated MDCSimpleTextField styled as a "filled" text field:
![stf_filled_2](https://user-images.githubusercontent.com/8020010/53023948-29713080-342c-11e9-9581-8891fa090ec1.gif)
This gif shows the updated InputChipView styled as an "outlined" input chip view whose chips do not wrap:
![outlined_non_wrapping_2](https://user-images.githubusercontent.com/8020010/53023945-28d89a00-342c-11e9-9138-c63ff1a4c3ea.gif)

This gif shows the updated InputChipView styled as an "outlined" input chip view whose chips wrap:
![outlined_wrapping_2](https://user-images.githubusercontent.com/8020010/53023944-28d89a00-342c-11e9-8e9d-ec185bcdf468.gif)
This gif shows the updated InputChipView styled as a "filled" input chip view whose chips do not wrap:
![filled_non_wrapping_2](https://user-images.githubusercontent.com/8020010/53023946-28d89a00-342c-11e9-9a4c-1fb5e87673e9.gif)
This gif shows the updated InputChipView styled as a "filled" input chip view whose chips wrap:
![filled_wrapping_2](https://user-images.githubusercontent.com/8020010/53023947-29713080-342c-11e9-98d2-3fe2f971d878.gif)
2019-02-20 09:47:42 -05:00
Joe Aguilar
fc7f30d012 [Catalog] Completed audit of swift forced unwrapping in catalog (#6186)
This work closes #3984.

This change audits the rest of the catalog swift examples force unwrapping. I had begun this process with PR #6117.
2019-02-06 11:01:48 -05:00
Robert Moore
800188a649
{clang-format} Format the components. (#6347)
This is a follow-up to https://github.com/material-components/material-components-ios/pull/6027

```
find components \( -name "*.h" -or -name "*.m" \) | xargs clang-format -i
```
2019-01-23 11:08:43 -05:00
Robert Moore
ab9cc0f4d7
[TextFields] Add experimental examples to bazel. (#6436)
Closes #6236
2019-01-22 20:19:49 -05:00
Andrew Overton
bc45f4d212
[TextFields] "SimpleTextField" Example Prototype (#6003)
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:
![simple-text-field-ltr](https://user-images.githubusercontent.com/8020010/49957272-4beb4880-fed5-11e8-85f4-9ab8a79c0305.gif)

And an RTL video:
![simple-text-field-rtl](https://user-images.githubusercontent.com/8020010/49957270-4beb4880-fed5-11e8-8fc6-e4af04c5a74b.gif)
2018-12-17 11:28:12 -05:00
Robert Moore
372d6b24f9
No longer using -init for Color Scheme. (#5734)
{MDC iOS} No longer using `-init` for Color Scheme.

Based on the discussions in go/mdc-ios-theming, we should not use the `-init` default initializer. Instead, we should use an explicit set of defaults.

Search regex: '\[\[MDCSemanticColorScheme alloc\] init\]'
2018-11-12 12:54:47 -05:00
Robert Moore
03f3351ad5
Global replace of single-precision floats with CGFloat casts. (#5718)
Replacing all non-integral, single-precision floating point literals with double-precision values explicitly cast to CGFloat.  For example, `0.1f` should become `(CGFloat)0.1`.

Regex used:
```
([0-9]*\.)([0-9]*?)([1-9]+)([0-9]*?)[fF]
```

PiperOrigin-RevId: 220683126
2018-11-12 10:50:01 -05:00
Robert Moore
74a27253e8
Global replace of integral single-precision literals with integer literals. (#5709)
Global replace of integral single-precision literals with integer literals.

Regular expression used:
```perl
/[^\w]([0-9]+)\.[0]*[fF]/$1/
```
2018-11-08 14:02:04 -05:00
Cody Weaver
ebd7921263
Remove extension check (#5182)
Previously we checked against `iOSApplicationExtension` and `iOS` but if the `iOS` version is 9.0 or above then the ApplicationExtension will be as well. This will remove a lot of warnings in our kokoro logs when trying to track down errors.

| Before | After |
| ------ | ------ |
|![simulator screen shot - iphone xs max - 2018-09-20 at 08 30 07](https://user-images.githubusercontent.com/7131294/45818633-4a342f00-bcb0-11e8-8e36-2c8079581c30.png)|![simulator screen shot - iphone xs max - 2018-09-20 at 08 29 32](https://user-images.githubusercontent.com/7131294/45818638-4e604c80-bcb0-11e8-91ea-664443d4be0a.png)|
|![simulator screen shot - iphone xs max - 2018-09-20 at 08 29 32](https://user-images.githubusercontent.com/7131294/45818703-81a2db80-bcb0-11e8-9e64-f67e6d72d063.png)|![simulator screen shot - iphone xs max - 2018-09-20 at 08 30 07](https://user-images.githubusercontent.com/7131294/45818712-8798bc80-bcb0-11e8-85ea-223859066421.png)|
2018-09-20 10:00:03 -04:00
featherless
2181084272
[automated] Standardize our open source license stanza to what Xcode generates. (#4985)
Removes the need to copy-paste stanzas from other files anymore as we'll rely on #4478 to generate the correct stanza for us instead.

This was an automated change generated by running a find-and-replace regular expression:

```
/\*
 Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.

 Licensed under the Apache License, Version 2\.0 \(the "License"\);
 you may not use this file except in compliance with the License\.
 You may obtain a copy of the License at

 http://www\.apache\.org/licenses/LICENSE-2\.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
 See the License for the specific language governing permissions and
 limitations under the License\.
 \*/
```

```
/\*
Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.

Licensed under the Apache License, Version 2\.0 \(the "License"\);
you may not use this file except in compliance with the License\.
You may obtain a copy of the License at

http://www\.apache\.org/licenses/LICENSE-2\.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
See the License for the specific language governing permissions and
limitations under the License\.
\*/
```

```
/\*
 Copyright ([0-9]+)-present the Material Components for iOS authors\. All Rights Reserved\.
 Licensed under the Apache License, Version 2\.0 \(the "License"\);
 you may not use this file except in compliance with the License\.
 You may obtain a copy of the License at
 http://www\.apache\.org/licenses/LICENSE-2\.0
 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.
 See the License for the specific language governing permissions and
 limitations under the License\.
 \*/
```

```
// Copyright $1-present the Material Components for iOS authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
```
2018-08-31 12:13:07 -04:00
Yarden Eitan
3480c50c67
updated to newest CbC standard (#4956)
Move to the new CbC standard released in CatalogByConvention v2.5.0. See PR: material-foundation/cocoapods-catalog-by-convention#27 for more info on the change.
2018-08-29 20:45:13 -04:00
featherless
bbe4a23fe0
Remove all __IPHONE_11_0 checks now that we no longer support Xcode 8. (#4915)
We can now make use of @available throughout our codebase.

We support Xcode 9 and up, which includes the iOS 11 SDK. This means we can remove any guards for SDKs prior to iOS 11.

This was cleaned up by running a global find-and-replace with the following regular expression:

```
Find:#if defined\(__IPHONE_11_0\) && \(__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0\)\n(.+if \(@available\(iOS 11.0, \*\)\) \{(?:.|\n)*?)(?:#else(?:.|\n)*?)?\n#endif
Replace:$1
```

With some additional cleanup for stragglers that didn't match this pattern. Note that else clauses were intentionally dropped.

Closes https://github.com/material-components/material-components-ios/issues/4909
2018-08-28 09:57:30 -04:00
Robert Moore
175942d9e0
[Catalog] Fix Swift example imports (#4780)
Many of our Swift examples are either missing imports or are importing all of
MaterialComponents. Both of these will cause failures during internal builds.
2018-08-14 13:26:37 -04:00
Andrew Overton
6acde0b275
[TextFields] Add setHelperText:helperAccessibilityLabel (#4661)
* Add setHelperText:helperAccessibilityLabel

* Add nullability annotations

* Do not copy helperText param in -setHelperText:

* Update filled text field example
2018-08-02 09:42:36 -04:00
Robert Moore
8835a412a2
[TextFields] Support clear button tint color (#4449)
Adding support to change the clearButton's tintColor from the TextInputController. This allows more consistent theming across controllers.

Closes #4447 

## Filled

**Before**
![screen shot 2018-06-29 at 12 23 12 pm](https://user-images.githubusercontent.com/1753199/42103490-427a1e96-7b97-11e8-9410-9d20f5ff6d32.png)


**After**
![screen shot 2018-06-29 at 12 21 51 pm](https://user-images.githubusercontent.com/1753199/42103502-4b1d8c22-7b97-11e8-85be-3997d0e3dee4.png)


## Outlined

**Before**
![screen shot 2018-06-29 at 12 23 01 pm](https://user-images.githubusercontent.com/1753199/42103497-45b2fca4-7b97-11e8-82df-3a01bc3e8240.png)

**After**
![screen shot 2018-06-29 at 12 21 36 pm](https://user-images.githubusercontent.com/1753199/42103498-48b22010-7b97-11e8-8c8e-004cb35d3b6a.png)
2018-06-29 15:44:09 -04:00
Will Larche
1f10ae3e3e
[TextFields] Making leading and trailing view layout customizeable (#4434)
Closes the layout part of b/74174981

***Breaks screenshot tests.

Before:
![simulator screen shot - iphone x - 2018-06-24 at 17 39 27](https://user-images.githubusercontent.com/1271525/41823956-2742affe-77d6-11e8-9082-2ccb10071750.png)

After:
![simulator screen shot - iphone x - 2018-06-24 at 17 35 45](https://user-images.githubusercontent.com/1271525/41823875-13f44152-77d5-11e8-8ae8-f23840efe6e1.png)

Also corrects the x of the floating placeholder on a filled text field.
![simulator screen shot - iphone x - 2018-06-24 at 17 45 43](https://user-images.githubusercontent.com/1271525/41823974-7e8c5346-77d6-11e8-88ce-38f4adb32323.png)
2018-06-25 07:59:33 -07:00
Ian Gordon
6012227068 Linter requires a prefix 2018-06-18 12:21:14 -04:00
Will Larche
bc119b3b73 [TextFields] Example cleanup. (#4392)
* [TextFields] Example cleanup.

* [TextFields] Copy correction

* [TextFields] Example file rename.
2018-06-12 17:41:02 -04:00
Will Larche
0516f703c8 [TextFields] TableView example. (#4391)
* [TextFields] TableView example.

* [TextFields] Testing feedback.

* [TextFields] Example correction.
2018-06-12 17:40:26 -04:00
Will Larche
89c2a40911
[TextFields] Add baseline constraint support (#4387)
Closes b/72401468
2018-06-11 15:18:37 -04:00
Robert Moore
a37b289153 [TextFields] Post SetText notifications for attributed text (#4282)
TextFields were not always correctly posting notifications when attributed
text was set programmatically. This can cause the placeholder to remain in its
"empty" position and overlap the text.

Also added some examples to demonstrate the behavior and fixed a typo.
2018-05-29 18:25:02 -04:00