{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\]'
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.
```
set cell selection style to none in following examples:
Activity Indicator Demo
App Bar Demo
AppBarSectionHeaderExample
AppBarImageryExample
closes#3870
This behavior enables the similarly-named behavior added to the Flexible Header in bb245597d8895a78c346c76f7d0986d7a993ad12. In addition to allowing the flexible header's min/max height to use the contextual safe area insets, the App Bar will use the flexible header view's top safe area guide to position its header view (rather than using MDCDeviceSafeAreaInsets(), which we want to remove).
This change enables the new behavior in the App Bar examples and in the MDCCatalog node list view controller.
Closes https://github.com/material-components/material-components-ios/issues/4104
This new opt-in behavior allows a client to more easily integrate the Flexible Header (and relatedly, the App Bar) when they do not require shifting behavior (which is most of the time).
The new behavior can be enabled by setting `observesTrackingScrollViewScrollEvents` to true on the flexible header view instance.
When this property is enabled, the flexible header will no longer allow tracking scroll view events to be manually forwarded, and it will also enforce the shift behavior being set to a disabled state. The intent of this enforcement is to encourage unambiguous usage of the flexible header (you're either allowing it to observe events, or you're forwarding events, but not both).
I've rolled this new behavior out to all of the App Bar examples to demonstrate how much code it removes. I expect this to be a large win for client teams that are integrating with the App Bar.
The underlying implementation of this new behavior relies on KVO of the scroll view's contentOffset property. We manage registration of KVO events through the fhv_startObservingContentOffset and fhv_stopObservingContentOffset APIs.
Prior to iOS 11, the KVO implementation of observers required that you deregister any observers from an object before it is deallocated. As such, if a client wishes to use this behavior and they also support iOS 10.* or below, they must also explicitly nil out the tracking scroll view before it is deallocated. This is required because we keep a weak reference to the tracking scroll view (for a variety of important reasons, namely: avoiding retain cycles and ensuring we don't keep the tracking scroll view alive longer than its owning controller). Because of the weak reference, we can't rely on our own dealloc method being invoked before the tracking scroll view is deallocated. As such, only the client who provided us with a tracking scroll view is capable of making an informed decision as to when to nil out the tracking scroll view. In essence, this behavior comes with a KVO contract (a cost) while providing a much easier integration experience (the benefit).
If a client supports iOS 11 and up, they can simply enable this behavior with no additional code.
Closes https://github.com/material-components/material-components-ios/issues/347
Made colorScheme and typographyScheme properties in the class interfaces for all our examples.
Moved theming away from example inits and into viewDidLoad
Small update for slider example to allow it to grab the theming properly.
Related Pivotal: https://www.pivotaltracker.com/story/show/156616695
All examples now have at least the required `+catalogBreadcrumbs` and `+catalogIsPrimaryDemo`. All examples in the same breadcrumbs path have only one primary demo. There should be only one `-catalogDescription` attached to the primary demo.
Closes#1897
Discussed merge with Ian offline. Issues with Travis CI may be resolved once the PR is merged.
* Add color to tiles.
* Add theming to catalog
* Update text field tile.
* Implementation method signatures should match those in header.
* Update MDCDrawFunc typedef
* Pass color scheme through NSNotification
* Add component theming
* Add tabbar themer
* Update tab example to use UIAppearance
* Theme sliders based on UIAppearance proxy
* Allow any class conforming to MDCColorScheme
* Override navigation bar color theme for imagery example.
* Update AppBar and ButtonBar color theming
* Update button bar themer comment
* Update button theming
* Remove theme imports where not necessary.
* Fix case of private
We can credit any contributor who would like to be credited this way, by adding them on request to the AUTHORS file. The copyright statement changes are required for this to work. Note that this has...
Summary:
We can credit any contributor who would like to be credited this way, by adding them on request to the AUTHORS file. The copyright statement changes are required for this to work. Note that this has no legal change, since the contributors always retained their copyright despite the copyright notice, but it's a nice acknowledgement.
Changed copyright statement to include non-Google authors.
Command run:
find * \( -name '*\.m' -or -name '*\.h' -or -name '*\.swift' \) -and -not \( -path 'scripts/external*' -name Pods \) -print0 | xargs -0 sed -i '' 's/Copyright \(.*\) Google Inc/Copyright \1 the Material Components for iOS authors/'
Added non-source files.
Command run:
grep -Rl 'Copyright .* Google Inc' * --exclude-dir scripts/external --null | xargs -0 sed -i '' 's/Copyright \(.*\) Google Inc/Copyright \1 the Material Components for iOS authors/'
Reviewers: featherless, O1 Material components iOS, randallli
Reviewed By: O1 Material components iOS, randallli
Tags: #material_components_ios
Differential Revision: http://codereview.cc/D1415
Summary: The catalog now calls init on view controllers to initialize them. This does not chain to initWithNibName.
Reviewers: #mdc_ios_owners, junius
Reviewed By: #mdc_ios_owners, junius
Projects: #material_components_ios
Differential Revision: http://codereview.cc/D689
Summary:
The argument justifying the protocol-oriented approach to App Bar was "convenience", but as is so often the case this convenience actually introduced a variety of costs. Notably:
- Properties defined in a protocol must be synthesized. This was annoying.
- We could not add new properties to the protocol without breaking all clients (they'd get "does not conform to protocol errors").
- We'd overcomplicated the view registration mechanisms. You now simply create an App Bar object and manage view controller parent/child relationships explicitly.
Before this change, clients using the App Bar had to:
1. Conform to a protocol.
2. Synthesize methods.
3. Call an initializer method.
4. Call a viewDidLoad method.
After this change, clients using the App Bar will:
1. Initialize an instance of MDCAppBar.
2. Register the App Bar's header view controller as a child view controller.
3. Call a viewDidLoad method.
Reviewers: ajsecord, #mdc_ios_owners
Reviewed By: ajsecord, #mdc_ios_owners
Projects: #material_components_ios
Differential Revision: http://codereview.cc/D446
Summary: This example shows how one might register a custom background image in the App Bar.
Reviewers: #mdc_ios_owners, ajsecord
Reviewed By: #mdc_ios_owners, ajsecord
Projects: #material_components_ios
Differential Revision: http://codereview.cc/D374