2016-05-18 16:45:45 -04:00
2016-05-18 16:45:45 -04:00
2016-05-09 10:52:09 -04:00
2015-11-25 11:39:04 -05:00
2016-04-12 09:55:55 -04:00
2016-03-22 15:47:06 -04:00
2015-10-07 10:43:30 -04:00
2016-04-12 14:34:23 -04:00

Material Components is a collection of standalone production-quality components.

Material Components visual style is based on the material design specification, developed by a team of iOS engineers and UX designers at Google.

Catalog

Catalog is a demonstration application that showcases the Material Components.

If you haven't checked out the repo yet:

pod try MaterialComponents

If you have checked out the repo:

pod install --project-directory=catalog/ --no-repo-update

Quickstart

1. Install CocoaPods

CocoaPods is the easiest way to get started. If you're new to CocoaPods, check out their getting started documentation.

To install CocoaPods, run the following commands:

sudo gem install cocoapods

2. Create Podfile

Once you've created an iOS application in Xcode you can start using Material Components for iOS.

To initialize CocoaPods in your project, run the following commands:

cd your-project-directory
pod init

3. Edit Podfile

Once you've initialized CocoaPods, add the Material Components iOS Pod to your target in your Podfile:

target "MyApp" do
  ...
  pod 'MaterialComponents'
end

If you are using Swift, dont forget to uncomment the use_frameworks! line at the top of your Podfile.

Then run the command:

pod install
open your-project.xcworkspace

Now you're ready to get started in Xcode.

4. Usage

Now youre ready to add a component (e.g. Buttons) to your app! Include the Material Components header for the component you're interested in to your app (detailed below) to get all of the required classes.

Choose from Objective-C or Swift:

Objective-C

#import "MaterialButtons.h"

@implementation ViewController

- (void)viewDidLoad {
  [super viewDidLoad];

  MDCRaisedButton *raisedButton = [MDCRaisedButton new];
  [raisedButton setTitle:@"Raised Button" forState:UIControlStateNormal];
  [raisedButton sizeToFit];
  [raisedButton addTarget:self
                   action:@selector(tapped:)
         forControlEvents:UIControlEventTouchUpInside];

  [self.view addSubview:raisedButton];
}

- (void)tapped:(id)sender {
  NSLog(@"Button was tapped!");
}

@end

Swift

import material_components_ios

class MDCBuildTestViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        let raiseButton = MDCRaisedButton.init();
        raiseButton.setTitle("Raised Button", forState: .Normal);
        raiseButton.sizeToFit();
        raiseButton.addTarget(self, action: "tapped:", forControlEvents: .TouchUpInside);
        self.view.addSubview(raiseButton);
    }

    func tapped(sender: UIButton!){
        NSLog("Button was tapped!");
    }

}

5. What's next?

Attributions

Material Components iOS uses Material Design icons, copyright Google Inc. and licensed under CC BY 4.0.

Roboto Font Loader uses the Roboto font, copyright 2011 Google Inc. and licensed under Apache 2.0 without a NOTICE file.

Description
[In maintenance mode] Modular and customizable Material Design UI components for iOS
Readme Apache-2.0 280 MiB
Languages
Objective-C 89%
Swift 7.9%
Shell 1.3%
Ruby 1.3%
Python 0.3%
Other 0.2%