和iOS上的使用方式大致相同
#import "ViewController.h"
#import 
@interface ViewController()
@property (nonatomic,strong) WKWebView *webView;
@end
@implementation ViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
    self.webView = [[WKWebView alloc] initWithFrame:self.view.bounds configuration:config];
    [self.view addSubview:self.webView];
     [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.baidu.com"]]];
}
@end
 
另外,还需要配置下工程文件,以允许WKWebView访问网络。需要配置的地方有两处

