All Projects → llyouss → Pawebview

llyouss / Pawebview

Licence: mit
An component WebView for iOS base on WKWebView

Labels

Projects that are alternatives of or similar to Pawebview

Marionette
🧸 Swift library which provides a high-level API to control a WKWebView
Stars: ✭ 374 (+121.3%)
Mutual labels:  wkwebview
Hybridpagekit
A high-performance、high-extensibility、easy integration framework for Hybrid content page. Support most content page types of News App.
Stars: ✭ 1,101 (+551.48%)
Mutual labels:  wkwebview
Ionic Native Http Connection Backend
A solution to CORS issues with Ionic and iOS
Stars: ✭ 142 (-15.98%)
Mutual labels:  wkwebview
Kkjsbridge
一站式解决 WKWebView 支持离线包,Ajax/Fetch 请求,表单请求和 Cookie 同步的问题 (基于 Ajax Hook,Fetch Hook 和 Cookie Hook)
Stars: ✭ 462 (+173.37%)
Mutual labels:  wkwebview
Ios tips
iOS的一些示例,持续更新中:1、AVFoundation 高仿微信相机拍摄和编辑 2、AVFoundation 人脸检测、实时滤镜、音视频编解码、GPUImage框架的使用等音视频相关内容 3、OpenGLES 4、LeetCode算法练习 5、iOS Crash防护和APM监控 6、WKWebView相关的内容 等........
Stars: ✭ 896 (+430.18%)
Mutual labels:  wkwebview
Youtubeplayerview
Helper library for iOS developers that want to embed YouTube videos in their iOS apps with the iframe player API. 📹
Stars: ✭ 72 (-57.4%)
Mutual labels:  wkwebview
Macpin
a webapp container & site specific browser made from WebKit.swift and JavaScriptCore
Stars: ✭ 289 (+71.01%)
Mutual labels:  wkwebview
Applemusicultra
Music Client for macOS. Upgrade your music experience with themes, styles, custom scripting and more. Uses WebKit and JavaScript.
Stars: ✭ 155 (-8.28%)
Mutual labels:  wkwebview
Wkwebviewjavascriptbridge
🌉 A Bridge for Sending Messages between Swift and JavaScript in WKWebViews.
Stars: ✭ 863 (+410.65%)
Mutual labels:  wkwebview
Mybrowser
我的浏览器,基于WKWebView实现的一个iOS浏览器,实现了无图模式、广告拦截、多窗口、扫描二维码、收藏夹/历史、无痕浏览、夜间模式等功能...
Stars: ✭ 127 (-24.85%)
Mutual labels:  wkwebview
React Native Wkwebview
WKWebview Component for React Native
Stars: ✭ 622 (+268.05%)
Mutual labels:  wkwebview
Tysnapshotscroll
一句代码保存截图,将 UIScrollView UITableView UICollectionView UIWebView WKWebView 网页 保存 为 长图 查看。Save the scroll view page as an image,support UIScrollView,UITableView,UICollectionView,UIWebView,WKWebView.(Support iOS13)
Stars: ✭ 709 (+319.53%)
Mutual labels:  wkwebview
Flutter inappwebview
A Flutter plugin that allows you to add an inline webview, to use a headless webview, and to open an in-app browser window.
Stars: ✭ 1,259 (+644.97%)
Mutual labels:  wkwebview
Xwebview
An extensible WebView for iOS (based on WKWebView)
Stars: ✭ 442 (+161.54%)
Mutual labels:  wkwebview
Lcwebview
www.strictfrog.com
Stars: ✭ 144 (-14.79%)
Mutual labels:  wkwebview
Wkwebview
WKWebView的使用、JS和OC的交互、网页内容加载进度条的实现、WKWebView+UITableView混排 、 WKWebView离线缓存
Stars: ✭ 366 (+116.57%)
Mutual labels:  wkwebview
Reusablenestingscrollview
An scrollView handler for UIScrollView & WKWebView and other scrollViews. Providing scrollview`s subViews reusable.
Stars: ✭ 61 (-63.91%)
Mutual labels:  wkwebview
Swiftui Webview
A SwiftUI component to use WKWebView
Stars: ✭ 158 (-6.51%)
Mutual labels:  wkwebview
Flwebview
WKWebView with UIWebView fallback for iOS.
Stars: ✭ 145 (-14.2%)
Mutual labels:  wkwebview
Flutter browser app
A Full-Featured Mobile Browser App (such as the Google Chrome mobile browser) created using Flutter and the features offered by the flutter_inappwebview plugin.
Stars: ✭ 85 (-49.7%)
Mutual labels:  wkwebview

PAWebView.

An component WebView for ios

Introduction

PAWeView is an extensible WebView which is built on top of WKWebView, the modern WebKit framework debuted in iOS 8.0. It provides fast Web for developing sophisticated iOS native or hybrid applications.

Sample Project

For a complete example on how to use PAWeView, see the Sample Project.

The Class Structure Chart of PAWeView

Image text

Minimum Requirements

  • Deployment: iOS 8.0

Usage

  • #import "PAWebView.h"
  • plist
     <key>UIViewControllerBasedStatusBarAppearance</key>
      <false/>
     <key>UIStatusBarStyle</key>
     <string>UIStatusBarStyleDefault</string>
     <key>NSPhotoLibraryUsageDescription</key>
     <string>访问相册</string>
     <key>NSAppTransportSecurity</key>
     <dict>
      <key>NSAllowsArbitraryLoads</key>
      <true/>
     </dict>
    
  • Loading
    //初始化单例  
     PAWebView *webView = [PAWebView shareInstance];  
     
    //加载网页  
    [webView loadRequestURL:[NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://www.sina.cn"] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:20.0f]];
     [self.navigationController pushViewController:webView animated:YES];
     
     //缓存沿用了 NSURLRequest 的缓存机制,用户可以自定义设置;
    typedef NS_ENUM(NSUInteger, NSURLRequestCachePolicy)
    {
        NSURLRequestUseProtocolCachePolicy = 0, //默认的缓存策略
    
        NSURLRequestReloadIgnoringLocalCacheData = 1, //忽略缓存,从服务端加载数据;
        NSURLRequestReloadIgnoringLocalAndRemoteCacheData = 4, // Unimplemented
        NSURLRequestReloadIgnoringCacheData = NSURLRequestReloadIgnoringLocalCacheData,
    
        NSURLRequestReturnCacheDataElseLoad = 2,
        NSURLRequestReturnCacheDataDontLoad = 3,
    
        NSURLRequestReloadRevalidatingCacheData = 5, // Unimplemented
    };
     
    
  • Refress
 //重新加载网页  
  [webView reload];   
 //无视缓存,重新加载服务器最新的网  
  [webView reloadFromOrigin]; 

  • JS->Native
/* messageHander实现JS调用Native */  
- (void)addMessageHander  
{  
  //注入交互事件,实现 PAWKScriptMessageHandler 代理  
   [webView addScriptMessageHandlerWithName:@[@"AliPay",@"weixin"]];  
 
  //通过block的形式实现  
   [webView addScriptMessageHandlerWithName:@[@"AliPay",@"weixin"] observeValue:^(WKUserContentController *userContentController, WKScriptMessage *message) {  
     
      //JS调用OC处理  
      NSLog(@"name:%@;body:%@",message.name,message.body);  
   }];  
}  
 
/* 实现 PAWKScriptMessageHandler 代理 */  
- (void)PAUserContentController: (WKUserContentController *) userContentController  didReceiveScriptMessage:(WKScriptMessage *)message{  
 
      //JS调用OC处理   
       NSLog(@"name:%@;body:%@",message.name,message.body);  
} 
  • Native -> JS
 //方式一、  
  [[PAWebView shareInstance] callJS:@"alert('调用JS成功')"];  
 //方式二、  
  [[PAWebView shareInstance] callJS:@"alert('调用JS成功')" handler:^(id response, NSError *error) {  
       NSLog(@"调用js回调事件");  
  }]; 
  • Cooikes Manager
/**
 读取本地磁盘的cookies,包括WKWebview的cookies和sharedHTTPCookieStorage存储的cookies

@return 返回包含所有的cookies的数组;
当系统低于 iOS11 时,cookies 将同步NSHTTPCookieStorage的cookies,当系统大于iOS11时,cookies 将同步
*/
- (NSMutableArray *)WKSharedHTTPCookieStorage;

/**
 提供cookies插入,用于loadRequest 网页之前

@param cookie NSHTTPCookie 类型
 cookie 需要设置 cookie 的name,value,domain,expiresDate(过期时间,当不设置过期时间,cookie将不会自动清除);
 cookie 设置expiresDate时使用 [cookieProperties setObject:expiresDate forKey:NSHTTPCookieExpires];将不起作用,原因不明;使用 cookieProperties[expiresDate] = expiresDate; 设置cookies 设置时间。
*/
- (void)setCookie:(NSHTTPCookie *)cookie;

/** 删除单个cookie */
- (void)deleteWKCookie:(NSHTTPCookie *)cookie completionHandler:(nullable void (^)(void))completionHandler;
/** 删除域名下的所有的cookie */
- (void)deleteWKCookiesByHost:(NSURL *)host completionHandler:(nullable void (^)(void))completionHandler;

/** 清除所有的cookies */
- (void)clearWKCookies;

  • 清除缓存

/** 清除所有缓存(cookie除外) */
- (void)clearWebCacheFinish:(void(^)(BOOL finish,NSError *error))block;

  • 清除 backForwardList 列表
/*清除backForwardList 列表*/
- (void)clearBackForwardList;

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].