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
..

Overlay window

Provides a window which can have an arbitrary number of overlay views that will sit above the root view of the window. Overlays will be the full size of the screen, and will be rotated as appropriate based on device orientation. For performance, owners of overlay views should set the |hidden| property to YES when the overlay is not in use.

Overlay Window is used by components such as Snackbar. Snackbar uses Overlay Window to ensure displayed message views are always visible to the user by being at the top of the view hierarchy.

Installation

Installation with CocoaPods

To add this component to your Xcode project using CocoaPods, add the following to your Podfile:

pod 'MaterialComponents/OverlayWindow'

Then, run the following command:

pod install

Usage

Importing

Before using the Overlay Window, you'll need to import it:

Swift

import MaterialComponents.MaterialOverlayWindow

Objective-C

#import "MaterialOverlayWindow.h"

Examples

Setting the Overlay Window

Using the Overlay Window requires that the App Delegate set the window as an Overlay Window or a subclass of Overlay Window.

Swift

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

  window = MDCOverlayWindow(frame: (application.keyWindow?.bounds)!)

}

Objective-C

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  [[MDCOverlayWindow alloc] initWithFrame:application.keyWindow.bounds];

}

Using the Overlay Window

Once the Overlay Window is set in the App Delegate, the client can use the Overlay Window to display views at the top most level of the view hierarchy.

Swift

// Set up view to be displayed in the overlay window.
let myOverlayView = UIView()
...

// When you're ready to show the overlay, activate it
if let overlayWindow = window as? MDCOverlayWindow {
  overlayWindow.activateOverlay(myOverlayView, withLevel:UIWindowLevelNormal)
}

Objective-C

// Set up view to be displayed in the overlay window.
UIView *overlayView = [[UIView alloc] init];
...

// When you're ready to show the overlay, activate it
if ([self.window isKindOfClass:[MDCOverlayWindow class]]) {
  MDCOverlayWindow *overlayWindow = (MDCOverlayWindow *)self.window;
  [overlayWindow activateOverlay:overlayView withLevel:UIWindowLevelNormal];
}