├── .swift-version ├── JXWebViewController ├── Assets │ └── .gitkeep ├── Classes │ ├── .gitkeep │ ├── JXLocalizedString.swift │ └── JXWebViewController.swift ├── zh-Hans.lproj │ └── Localizable.strings ├── zh-Hant.lproj │ └── Localizable.strings └── en.lproj │ └── Localizable.strings ├── Example ├── .gitignore ├── Podfile ├── JXWebViewController.xcodeproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── JXWebViewController-Example.xcscheme │ └── project.pbxproj ├── JXWebViewController.xcworkspace │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── contents.xcworkspacedata ├── Tests │ ├── Info.plist │ └── Tests.swift └── JXWebViewController │ ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Info.plist │ ├── AppDelegate.swift │ └── Base.lproj │ └── LaunchScreen.xib ├── .travis.yml ├── .gitignore ├── CHANGELOG.md ├── LICENSE ├── JXWebViewController.podspec ├── .swiftlint.yml └── README.md /.swift-version: -------------------------------------------------------------------------------- 1 | 5.0 2 | -------------------------------------------------------------------------------- /JXWebViewController/Assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /JXWebViewController/Classes/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Example/.gitignore: -------------------------------------------------------------------------------- 1 | Pods/ 2 | Podfile.lock 3 | -------------------------------------------------------------------------------- /JXWebViewController/zh-Hans.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | "Cancel" = "取消"; 2 | "Close" = "关闭"; 3 | "Log In" = "登录"; 4 | "Log in to" = "登录 %@"; 5 | "OK" = "好"; 6 | "Password" = "密码"; 7 | "User Name" = "用户名"; 8 | -------------------------------------------------------------------------------- /JXWebViewController/zh-Hant.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | "Cancel" = "取消"; 2 | "Close" = "關閉"; 3 | "Log In" = "登入"; 4 | "Log in to" = "登入「 %@」"; 5 | "OK" = "好"; 6 | "Password" = "密碼"; 7 | "User Name" = "使用者名稱"; 8 | -------------------------------------------------------------------------------- /JXWebViewController/en.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | "Cancel" = "Cancel"; 2 | "Close" = "Close"; 3 | "Log In" = "Log In"; 4 | "Log in to" = "Log in to %@"; 5 | "OK" = "OK"; 6 | "Password" = "Password"; 7 | "User Name" = "User Name"; 8 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | target 'JXWebViewController_Example' do 4 | pod 'JXWebViewController', :path => '../' 5 | 6 | target 'JXWebViewController_Tests' do 7 | inherit! :search_paths 8 | 9 | 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /Example/JXWebViewController.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/JXWebViewController.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/JXWebViewController.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /JXWebViewController/Classes/JXLocalizedString.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JXLocalizedString.swift 3 | // JXWebViewController 4 | // 5 | // Created by swordray on 01/17/2018. 6 | // Copyright (c) 2018 swordray. All rights reserved. 7 | // 8 | 9 | func JXLocalizedString(_ key: String) -> String { 10 | guard let path = Bundle(for: JXWebViewController.self).path(forResource: "JXWebViewController", ofType: "bundle") else { return "" } 11 | guard let bundle = Bundle(path: path) else { return "" } 12 | return NSLocalizedString(key, bundle: bundle, comment: "") 13 | } 14 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * http://www.objc.io/issue-6/travis-ci.html 3 | # * https://github.com/supermarin/xcpretty#usage 4 | 5 | osx_image: xcode9.2 6 | language: objective-c 7 | cache: cocoapods 8 | podfile: Example/Podfile 9 | before_install: 10 | - gem install cocoapods # Since Travis is not always on latest version 11 | - pod install --project-directory=Example 12 | script: 13 | - set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/JXWebViewController.xcworkspace -scheme JXWebViewController-Example -sdk iphonesimulator11.2 -destination 'platform=iOS Simulator,name=iPhone X,OS=11.2' ONLY_ACTIVE_ARCH=NO | xcpretty 14 | - pod lib lint 15 | -------------------------------------------------------------------------------- /Example/Tests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata/ 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | 22 | # Bundler 23 | .bundle 24 | 25 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 26 | # Carthage/Checkouts 27 | 28 | Carthage/Build 29 | 30 | # We recommend against adding the Pods directory to your .gitignore. However 31 | # you should judge for yourself, the pros and cons are mentioned at: 32 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 33 | # 34 | # Note: if you ignore the Pods directory, make sure to uncomment 35 | # `pod install` in .travis.yml 36 | # 37 | # Pods/ 38 | -------------------------------------------------------------------------------- /Example/Tests/Tests.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import XCTest 3 | import JXWebViewController 4 | 5 | class Tests: XCTestCase { 6 | 7 | override func setUp() { 8 | super.setUp() 9 | // Put setup code here. This method is called before the invocation of each test method in the class. 10 | } 11 | 12 | override func tearDown() { 13 | // Put teardown code here. This method is called after the invocation of each test method in the class. 14 | super.tearDown() 15 | } 16 | 17 | func testExample() { 18 | // This is an example of a functional test case. 19 | XCTAssert(true, "Pass") 20 | } 21 | 22 | func testPerformanceExample() { 23 | // This is an example of a performance test case. 24 | self.measure() { 25 | // Put the code you want to measure the time of here. 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## Unreleased 4 | 5 | ## 1.3.0 (2020-07-14) 6 | 7 | * Update SwiftLint 0.39.0 8 | * Drop deperated 3D Touch support 9 | 10 | ## 1.2.1 (2019-05-08) 11 | 12 | * Update Swift 5.0 13 | 14 | ## 1.1.0 (2018-09-16) 15 | 16 | * Update Swift 4.2 17 | 18 | ## 1.0.1 (2018-09-15) 19 | 20 | * Add swift_version to CocoaPods 21 | 22 | ## 1.0.0 (2018-08-10) 23 | 24 | * Support Handoff from app to Safari 25 | * Rename `configuration` to `webViewConfiguration` 26 | * Update SwiftLint 0.26.0 27 | 28 | ## 0.2.0 (2018-06-24) 29 | 30 | * Block-based KVO 31 | 32 | ## 0.1.2 (2018-04-08) 33 | 34 | * Add SwiftLint 35 | * Fix overriding `webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error)` 36 | 37 | ## 0.1.1 (2018-02-12) 38 | 39 | * Fix Travis CI 40 | * Set preferred action to 'OK' 41 | * Fix 'Returned WKWebView was not created with the given configuration.' 42 | 43 | ## 0.1.0 (2018-01-18) 44 | 45 | * First release 46 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 swordray 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Example/JXWebViewController/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "size" : "1024x1024", 46 | "scale" : "1x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Example/JXWebViewController/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /JXWebViewController.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint JXWebViewController.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = 'JXWebViewController' 11 | s.version = '1.3.1' 12 | s.summary = 'An iOS view controller wrapper for WKWebView.' 13 | 14 | # This description is used to generate tags and improve search results. 15 | # * Think: What does it do? Why did you write it? What is the focus? 16 | # * Try to keep it short, snappy and to the point. 17 | # * Write the description between the DESC delimiters below. 18 | # * Finally, don't worry about the indent, CocoaPods strips it! 19 | 20 | s.description = <<-DESC 21 | Since iOS 8, WKWebView is preferred over UIWebView. But unlike UIWebView, WKWebView provide less default behaviors due to the security design. JXWebViewController wrap up a WKWebView and implements a few standard features as iOS Safari does. So web views can be easily used in your apps out-of-the-box. It is also referred to as WebViewController, UIWebViewController or WKWebViewController. 22 | DESC 23 | 24 | s.homepage = 'https://bailushuyuan.org' 25 | # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' 26 | s.license = { :type => 'MIT', :file => 'LICENSE' } 27 | s.author = { 'Jianqiu Xiao' => 'swordray@gmail.com' } 28 | s.source = { :git => 'https://github.com/swordray/JXWebViewController.git', :tag => s.version.to_s } 29 | # s.social_media_url = 'https://twitter.com/' 30 | 31 | s.ios.deployment_target = '11.0' 32 | 33 | s.source_files = 'JXWebViewController/Classes/**/*' 34 | 35 | s.resource_bundles = { 36 | 'JXWebViewController' => ['JXWebViewController/*.lproj'] 37 | } 38 | 39 | # s.public_header_files = 'Pod/Classes/**/*.h' 40 | s.frameworks = 'UIKit', 'WebKit' 41 | # s.dependency 'AFNetworking', '~> 2.3' 42 | 43 | s.swift_version = '5.0' 44 | end 45 | -------------------------------------------------------------------------------- /.swiftlint.yml: -------------------------------------------------------------------------------- 1 | excluded: 2 | - Example 3 | 4 | disabled_rules: 5 | - cyclomatic_complexity 6 | - file_length 7 | - function_body_length 8 | - line_length 9 | - nesting 10 | - type_body_length 11 | 12 | opt_in_rules: 13 | - anyobject_protocol 14 | - array_init 15 | - closure_end_indentation 16 | - closure_spacing 17 | - collection_alignment 18 | - contains_over_filter_count 19 | - contains_over_filter_is_empty 20 | - contains_over_first_not_nil 21 | - contains_over_range_nil_comparison 22 | - convenience_type 23 | - discouraged_object_literal 24 | - empty_collection_literal 25 | - empty_xctest_method 26 | - enum_case_associated_values_count 27 | - expiring_todo 28 | - explicit_init 29 | - extension_access_modifier 30 | - fallthrough 31 | - fatal_error_message 32 | - file_name 33 | - file_name_no_space 34 | - first_where 35 | - flatmap_over_map_reduce 36 | - force_unwrapping 37 | - function_default_parameter_at_end 38 | - identical_operands 39 | - implicit_return 40 | - indentation_width 41 | - joined_default_parameter 42 | - last_where 43 | - legacy_multiple 44 | - legacy_random 45 | - let_var_whitespace 46 | - literal_expression_end_indentation 47 | - modifier_order 48 | - multiline_arguments 49 | - multiline_function_chains 50 | - multiline_literal_brackets 51 | - multiline_parameters 52 | - multiline_parameters_brackets 53 | - nimble_operator 54 | - no_extension_access_modifier 55 | - number_separator 56 | - operator_usage_whitespace 57 | - optional_enum_case_matching 58 | - overridden_super_call 59 | - override_in_extension 60 | - pattern_matching_keywords 61 | - prefer_self_type_over_type_of_self 62 | - prefixed_toplevel_constant 63 | - private_action 64 | - private_outlet 65 | - prohibited_interface_builder 66 | - quick_discouraged_call 67 | - quick_discouraged_focused_test 68 | - quick_discouraged_pending_test 69 | - reduce_into 70 | - redundant_type_annotation 71 | - required_enum_case 72 | - single_test_class 73 | - sorted_first_last 74 | - sorted_imports 75 | - static_operator 76 | - strict_fileprivate 77 | - strong_iboutlet 78 | - switch_case_on_newline 79 | - trailing_closure 80 | - toggle_bool 81 | - unavailable_function 82 | - unneeded_parentheses_in_closure_argument 83 | - unowned_variable_capture 84 | - untyped_error_in_catch 85 | - unused_declaration 86 | - unused_import 87 | - unused_private_declaration 88 | - vertical_parameter_alignment_on_call 89 | - vertical_whitespace_between_cases 90 | - vertical_whitespace_closing_braces 91 | - xct_specific_matcher 92 | - yoda_condition 93 | 94 | trailing_comma: 95 | mandatory_comma: true 96 | -------------------------------------------------------------------------------- /Example/JXWebViewController/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // JXWebViewController 4 | // 5 | // Created by swordray on 01/17/2018. 6 | // Copyright (c) 2018 swordray. All rights reserved. 7 | // 8 | 9 | import JXWebViewController 10 | import UIKit 11 | 12 | @UIApplicationMain 13 | class AppDelegate: UIResponder, UIApplicationDelegate { 14 | 15 | var window: UIWindow? 16 | 17 | 18 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 19 | 20 | let url = URL(string: "https://example.com/")! 21 | 22 | let webViewController = JXWebViewController() 23 | webViewController.webView.load(URLRequest(url: url)) 24 | 25 | window = UIWindow(frame: UIScreen.main.bounds) 26 | window?.rootViewController = webViewController 27 | window?.makeKeyAndVisible() 28 | 29 | return true 30 | } 31 | 32 | func applicationWillResignActive(_ application: UIApplication) { 33 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 34 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 35 | } 36 | 37 | func applicationDidEnterBackground(_ application: UIApplication) { 38 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 39 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 40 | } 41 | 42 | func applicationWillEnterForeground(_ application: UIApplication) { 43 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 44 | } 45 | 46 | func applicationDidBecomeActive(_ application: UIApplication) { 47 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 48 | } 49 | 50 | func applicationWillTerminate(_ application: UIApplication) { 51 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 52 | } 53 | 54 | 55 | } 56 | 57 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JXWebViewController 2 | 3 | An iOS view controller wrapper for [WKWebView](https://developer.apple.com/documentation/webkit/wkwebview). 4 | 5 | [![CI Status](http://img.shields.io/travis/swordray/JXWebViewController.svg?style=flat)](https://travis-ci.org/swordray/JXWebViewController) 6 | [![Version](https://img.shields.io/cocoapods/v/JXWebViewController.svg?style=flat)](http://cocoapods.org/pods/JXWebViewController) 7 | [![License](https://img.shields.io/cocoapods/l/JXWebViewController.svg?style=flat)](http://cocoapods.org/pods/JXWebViewController) 8 | [![Platform](https://img.shields.io/cocoapods/p/JXWebViewController.svg?style=flat)](http://cocoapods.org/pods/JXWebViewController) 9 | 10 | Since iOS 8, WKWebView is preferred over UIWebView. But unlike UIWebView, WKWebView provide less default behaviors due to the security design. JXWebViewController wrap up a WKWebView and implements a few standard features as iOS Safari does. So web views can be easily used in your apps out-of-the-box. It is also referred to as WebViewController, UIWebViewController or WKWebViewController. 11 | 12 | ## Features 13 | 14 | * Allows back forward navigation gestures. 15 | * Support HTTP Basic access authentication. 16 | * Implement JavaScript `alert`, `confirm` and `prompt`. 17 | * Open native links of `mailto`, `tel`, `itms-apps` and so on. 18 | * Open and close pages in current view. 19 | * Reload when web content process is terminated. 20 | * Perform auto detection of phone numbers. 21 | * Proxy the page title to the controller title. 22 | * Add the refresh control. 23 | * Support Handoff from app to Safari. 24 | 25 | ## Requirements 26 | 27 | * iOS 11.0+ 28 | * Xcode 9.0+ 29 | * Swift 4.0+ 30 | 31 | ## Installation 32 | 33 | JXWebViewController is available through [CocoaPods](http://cocoapods.org). To install 34 | it, simply add the following line to your Podfile: 35 | 36 | ```ruby 37 | pod 'JXWebViewController' 38 | ``` 39 | 40 | ## Usage 41 | 42 | ### Quick Start 43 | 44 | ```swift 45 | let url = URL(string: "https://example.com/")! 46 | 47 | let webViewController = JXWebViewController() 48 | webViewController.webView.load(URLRequest(url: url)) 49 | navigationController?.pushViewController(webViewController, animated: true) 50 | ``` 51 | 52 | ### Customization 53 | 54 | * Use `webView` property to access the [WKWebView](https://developer.apple.com/documentation/webkit/wkwebview) instance. 55 | * Use `webViewConfiguration` property to set up [WKWebViewConfiguration](https://developer.apple.com/documentation/webkit/wkwebviewconfiguration) before view is loaded. 56 | * Create a `JXWebViewController` subclass which implements or overrides [WKNavigationDelegate](https://developer.apple.com/documentation/webkit/wknavigationdelegate) and [WKUIDelegate](https://developer.apple.com/documentation/webkit/wkuidelegate) methods. 57 | 58 | ## Credits 59 | 60 | Jianqiu Xiao, swordray@gmail.com 61 | 62 | ## Sponsors 63 | 64 | * [BaiLu ShuYuan](https://bailushuyuan.org) 65 | 66 | ## License 67 | 68 | JXWebViewController is available under the MIT license. See the LICENSE file for more info. 69 | -------------------------------------------------------------------------------- /Example/JXWebViewController/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 25 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /Example/JXWebViewController.xcodeproj/xcshareddata/xcschemes/JXWebViewController-Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 67 | 68 | 78 | 80 | 86 | 87 | 88 | 89 | 90 | 91 | 97 | 99 | 105 | 106 | 107 | 108 | 110 | 111 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /JXWebViewController/Classes/JXWebViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // JXWebViewController.swift 3 | // JXWebViewController 4 | // 5 | // Created by swordray on 01/17/2018. 6 | // Copyright (c) 2018 swordray. All rights reserved. 7 | // 8 | 9 | import WebKit 10 | 11 | open class JXWebViewController: UIViewController { 12 | 13 | open var webViewConfiguration: WKWebViewConfiguration 14 | open var webViewKeyValueObservations: [AnyKeyPath: NSKeyValueObservation] 15 | 16 | open var webView: WKWebView { 17 | loadViewIfNeeded() 18 | return view as? WKWebView ?? .init() 19 | } 20 | 21 | override public init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { 22 | webViewConfiguration = WKWebViewConfiguration() 23 | webViewConfiguration.dataDetectorTypes = .phoneNumber 24 | 25 | webViewKeyValueObservations = [:] 26 | 27 | super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) 28 | 29 | userActivity = NSUserActivity(activityType: NSUserActivityTypeBrowsingWeb) 30 | } 31 | 32 | @available(*, unavailable) 33 | public required init?(coder aDecoder: NSCoder) { 34 | fatalError("init(coder:) has not been implemented") 35 | } 36 | 37 | override open func loadView() { 38 | let webView = WKWebView(frame: .zero, configuration: webViewConfiguration) 39 | webView.allowsBackForwardNavigationGestures = true 40 | webView.navigationDelegate = self 41 | webView.scrollView.refreshControl = UIRefreshControl() 42 | webView.scrollView.refreshControl?.addTarget(webView, action: #selector(webView.reload), for: .valueChanged) 43 | webView.uiDelegate = self 44 | view = webView 45 | 46 | webViewKeyValueObservations[\WKWebView.title] = webView.observe(\.title, options: .new) { webView, _ in 47 | self.title = webView.title 48 | } 49 | 50 | webViewKeyValueObservations[\WKWebView.url] = webView.observe(\.url) { webView, _ in 51 | if let url = webView.url, ["http", "https"].contains(url.scheme) { 52 | self.userActivity?.webpageURL = url 53 | self.userActivity?.needsSave = true 54 | } 55 | } 56 | } 57 | 58 | override open func viewWillAppear(_ animated: Bool) { 59 | super.viewWillAppear(animated) 60 | 61 | userActivity?.becomeCurrent() 62 | } 63 | 64 | override open func viewDidDisappear(_ animated: Bool) { 65 | super.viewDidDisappear(animated) 66 | 67 | userActivity?.invalidate() 68 | } 69 | } 70 | 71 | extension JXWebViewController: WKNavigationDelegate { 72 | 73 | open func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { 74 | switch challenge.protectionSpace.authenticationMethod { 75 | case NSURLAuthenticationMethodHTTPBasic: 76 | let title = String.localizedStringWithFormat(JXLocalizedString("Log in to"), challenge.protectionSpace.host) 77 | let alertController = UIAlertController(title: title, message: nil, preferredStyle: .alert) 78 | alertController.addTextField { textField in 79 | textField.placeholder = JXLocalizedString("User Name") 80 | textField.text = challenge.proposedCredential?.user 81 | } 82 | alertController.addTextField { textField in 83 | textField.isSecureTextEntry = true 84 | textField.placeholder = JXLocalizedString("Password") 85 | textField.text = challenge.proposedCredential?.password 86 | } 87 | alertController.addAction(UIAlertAction(title: JXLocalizedString("Cancel"), style: .cancel) { _ in 88 | completionHandler(.cancelAuthenticationChallenge, nil) 89 | }) 90 | alertController.addAction(UIAlertAction(title: JXLocalizedString("Log In"), style: .default) { _ in 91 | let user = alertController.textFields?.first?.text ?? "" 92 | let password = alertController.textFields?.last?.text ?? "" 93 | let credential = URLCredential(user: user, password: password, persistence: .forSession) 94 | completionHandler(.useCredential, credential) 95 | }) 96 | alertController.preferredAction = alertController.actions.last 97 | present(alertController, animated: true) 98 | 99 | default: 100 | completionHandler(.performDefaultHandling, nil) 101 | } 102 | } 103 | 104 | open func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) { 105 | webView.scrollView.refreshControl?.endRefreshing() 106 | } 107 | 108 | open func webView(_ webView: WKWebView, didFailProvisionalNavigation navigation: WKNavigation!, withError error: Error) { 109 | webView.scrollView.refreshControl?.endRefreshing() 110 | } 111 | 112 | open func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { 113 | webView.scrollView.refreshControl?.endRefreshing() 114 | } 115 | 116 | open func webViewWebContentProcessDidTerminate(_ webView: WKWebView) { 117 | webView.reload() 118 | } 119 | 120 | open func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) { 121 | if let url = navigationAction.request.url { 122 | if !WKWebView.handlesURLScheme(url.scheme ?? "") && UIApplication.shared.canOpenURL(url) { 123 | UIApplication.shared.open(url) 124 | } 125 | } 126 | decisionHandler(.allow) 127 | } 128 | } 129 | 130 | extension JXWebViewController: WKUIDelegate { 131 | 132 | open func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? { 133 | if !(navigationAction.targetFrame?.isMainFrame ?? false) { 134 | webView.load(navigationAction.request) 135 | } 136 | return nil 137 | } 138 | 139 | open func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping () -> Void) { 140 | let alertController = UIAlertController(title: message, message: nil, preferredStyle: .alert) 141 | alertController.addAction(UIAlertAction(title: JXLocalizedString("Close"), style: .default) { _ in 142 | completionHandler() 143 | }) 144 | present(alertController, animated: true) 145 | } 146 | 147 | open func webView(_ webView: WKWebView, runJavaScriptConfirmPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (Bool) -> Void) { 148 | let alertController = UIAlertController(title: message, message: nil, preferredStyle: .alert) 149 | alertController.addAction(UIAlertAction(title: JXLocalizedString("Cancel"), style: .cancel) { _ in 150 | completionHandler(false) 151 | }) 152 | alertController.addAction(UIAlertAction(title: JXLocalizedString("OK"), style: .default) { _ in 153 | completionHandler(true) 154 | }) 155 | alertController.preferredAction = alertController.actions.last 156 | present(alertController, animated: true) 157 | } 158 | 159 | open func webView(_ webView: WKWebView, runJavaScriptTextInputPanelWithPrompt prompt: String, defaultText: String?, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping (String?) -> Void) { 160 | let alertController = UIAlertController(title: prompt, message: nil, preferredStyle: .alert) 161 | alertController.addTextField { textField in 162 | textField.text = defaultText 163 | } 164 | alertController.addAction(UIAlertAction(title: JXLocalizedString("Cancel"), style: .cancel) { _ in 165 | completionHandler(nil) 166 | }) 167 | alertController.addAction(UIAlertAction(title: JXLocalizedString("OK"), style: .default) { _ in 168 | completionHandler(alertController.textFields?.first?.text) 169 | }) 170 | alertController.preferredAction = alertController.actions.last 171 | present(alertController, animated: true) 172 | } 173 | 174 | open func webViewDidClose(_ webView: WKWebView) { 175 | guard let url = URL(string: "about:blank") else { return } 176 | webView.load(URLRequest(url: url)) 177 | } 178 | } 179 | -------------------------------------------------------------------------------- /Example/JXWebViewController.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; }; 11 | 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; }; 12 | 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; }; 13 | 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; }; 14 | 7F7AFD7F0608A43B5F9EE756 /* Pods_JXWebViewController_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 022F221042E9EEB583BE3D44 /* Pods_JXWebViewController_Example.framework */; }; 15 | 80FCD10798BF0D4E17167ED2 /* Pods_JXWebViewController_Tests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 593DACE0A6FED66874540691 /* Pods_JXWebViewController_Tests.framework */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXContainerItemProxy section */ 19 | 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */ = { 20 | isa = PBXContainerItemProxy; 21 | containerPortal = 607FACC81AFB9204008FA782 /* Project object */; 22 | proxyType = 1; 23 | remoteGlobalIDString = 607FACCF1AFB9204008FA782; 24 | remoteInfo = JXWebViewController; 25 | }; 26 | /* End PBXContainerItemProxy section */ 27 | 28 | /* Begin PBXFileReference section */ 29 | 022F221042E9EEB583BE3D44 /* Pods_JXWebViewController_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_JXWebViewController_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | 1A57F28A7720184323C3C727 /* JXWebViewController.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = JXWebViewController.podspec; path = ../JXWebViewController.podspec; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 31 | 4B65C0659F9544C6F53052FA /* Pods-JXWebViewController_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JXWebViewController_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-JXWebViewController_Tests/Pods-JXWebViewController_Tests.debug.xcconfig"; sourceTree = ""; }; 32 | 53FF8E79B3D8202D6D5706F6 /* Pods-JXWebViewController_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JXWebViewController_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-JXWebViewController_Tests/Pods-JXWebViewController_Tests.release.xcconfig"; sourceTree = ""; }; 33 | 593DACE0A6FED66874540691 /* Pods_JXWebViewController_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_JXWebViewController_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | 607FACD01AFB9204008FA782 /* JXWebViewController_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JXWebViewController_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 36 | 607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 37 | 607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 38 | 607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 39 | 607FACE51AFB9204008FA782 /* JXWebViewController_Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = JXWebViewController_Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 41 | 607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = ""; }; 42 | 7386D403B0077938FBBB54BE /* Pods-JXWebViewController_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JXWebViewController_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-JXWebViewController_Example/Pods-JXWebViewController_Example.release.xcconfig"; sourceTree = ""; }; 43 | 7E0E5E57486639E73027E1A8 /* Pods-JXWebViewController_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JXWebViewController_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-JXWebViewController_Example/Pods-JXWebViewController_Example.debug.xcconfig"; sourceTree = ""; }; 44 | 9A149C899AE4A1F847D5B865 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; 45 | A9EEA3D888CA68260F5020BC /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; 46 | /* End PBXFileReference section */ 47 | 48 | /* Begin PBXFrameworksBuildPhase section */ 49 | 607FACCD1AFB9204008FA782 /* Frameworks */ = { 50 | isa = PBXFrameworksBuildPhase; 51 | buildActionMask = 2147483647; 52 | files = ( 53 | 7F7AFD7F0608A43B5F9EE756 /* Pods_JXWebViewController_Example.framework in Frameworks */, 54 | ); 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | 607FACE21AFB9204008FA782 /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | 80FCD10798BF0D4E17167ED2 /* Pods_JXWebViewController_Tests.framework in Frameworks */, 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | 2FD48147D5AF2F8E3C47F218 /* Pods */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | 7E0E5E57486639E73027E1A8 /* Pods-JXWebViewController_Example.debug.xcconfig */, 72 | 7386D403B0077938FBBB54BE /* Pods-JXWebViewController_Example.release.xcconfig */, 73 | 4B65C0659F9544C6F53052FA /* Pods-JXWebViewController_Tests.debug.xcconfig */, 74 | 53FF8E79B3D8202D6D5706F6 /* Pods-JXWebViewController_Tests.release.xcconfig */, 75 | ); 76 | name = Pods; 77 | sourceTree = ""; 78 | }; 79 | 4F729C3DE32CF483CD2803F7 /* Frameworks */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 022F221042E9EEB583BE3D44 /* Pods_JXWebViewController_Example.framework */, 83 | 593DACE0A6FED66874540691 /* Pods_JXWebViewController_Tests.framework */, 84 | ); 85 | name = Frameworks; 86 | sourceTree = ""; 87 | }; 88 | 607FACC71AFB9204008FA782 = { 89 | isa = PBXGroup; 90 | children = ( 91 | 607FACF51AFB993E008FA782 /* Podspec Metadata */, 92 | 607FACD21AFB9204008FA782 /* Example for JXWebViewController */, 93 | 607FACE81AFB9204008FA782 /* Tests */, 94 | 607FACD11AFB9204008FA782 /* Products */, 95 | 2FD48147D5AF2F8E3C47F218 /* Pods */, 96 | 4F729C3DE32CF483CD2803F7 /* Frameworks */, 97 | ); 98 | sourceTree = ""; 99 | }; 100 | 607FACD11AFB9204008FA782 /* Products */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 607FACD01AFB9204008FA782 /* JXWebViewController_Example.app */, 104 | 607FACE51AFB9204008FA782 /* JXWebViewController_Tests.xctest */, 105 | ); 106 | name = Products; 107 | sourceTree = ""; 108 | }; 109 | 607FACD21AFB9204008FA782 /* Example for JXWebViewController */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | 607FACD51AFB9204008FA782 /* AppDelegate.swift */, 113 | 607FACDC1AFB9204008FA782 /* Images.xcassets */, 114 | 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */, 115 | 607FACD31AFB9204008FA782 /* Supporting Files */, 116 | ); 117 | name = "Example for JXWebViewController"; 118 | path = JXWebViewController; 119 | sourceTree = ""; 120 | }; 121 | 607FACD31AFB9204008FA782 /* Supporting Files */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 607FACD41AFB9204008FA782 /* Info.plist */, 125 | ); 126 | name = "Supporting Files"; 127 | sourceTree = ""; 128 | }; 129 | 607FACE81AFB9204008FA782 /* Tests */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | 607FACEB1AFB9204008FA782 /* Tests.swift */, 133 | 607FACE91AFB9204008FA782 /* Supporting Files */, 134 | ); 135 | path = Tests; 136 | sourceTree = ""; 137 | }; 138 | 607FACE91AFB9204008FA782 /* Supporting Files */ = { 139 | isa = PBXGroup; 140 | children = ( 141 | 607FACEA1AFB9204008FA782 /* Info.plist */, 142 | ); 143 | name = "Supporting Files"; 144 | sourceTree = ""; 145 | }; 146 | 607FACF51AFB993E008FA782 /* Podspec Metadata */ = { 147 | isa = PBXGroup; 148 | children = ( 149 | 1A57F28A7720184323C3C727 /* JXWebViewController.podspec */, 150 | 9A149C899AE4A1F847D5B865 /* README.md */, 151 | A9EEA3D888CA68260F5020BC /* LICENSE */, 152 | ); 153 | name = "Podspec Metadata"; 154 | sourceTree = ""; 155 | }; 156 | /* End PBXGroup section */ 157 | 158 | /* Begin PBXNativeTarget section */ 159 | 607FACCF1AFB9204008FA782 /* JXWebViewController_Example */ = { 160 | isa = PBXNativeTarget; 161 | buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "JXWebViewController_Example" */; 162 | buildPhases = ( 163 | 310DE011C0834D1D43463F1D /* [CP] Check Pods Manifest.lock */, 164 | 607FACCC1AFB9204008FA782 /* Sources */, 165 | 607FACCD1AFB9204008FA782 /* Frameworks */, 166 | 607FACCE1AFB9204008FA782 /* Resources */, 167 | EFAC6D66D473C4689B4A8582 /* [CP] Embed Pods Frameworks */, 168 | ); 169 | buildRules = ( 170 | ); 171 | dependencies = ( 172 | ); 173 | name = JXWebViewController_Example; 174 | productName = JXWebViewController; 175 | productReference = 607FACD01AFB9204008FA782 /* JXWebViewController_Example.app */; 176 | productType = "com.apple.product-type.application"; 177 | }; 178 | 607FACE41AFB9204008FA782 /* JXWebViewController_Tests */ = { 179 | isa = PBXNativeTarget; 180 | buildConfigurationList = 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "JXWebViewController_Tests" */; 181 | buildPhases = ( 182 | 60262E68B106406EF8AA04B4 /* [CP] Check Pods Manifest.lock */, 183 | 607FACE11AFB9204008FA782 /* Sources */, 184 | 607FACE21AFB9204008FA782 /* Frameworks */, 185 | 607FACE31AFB9204008FA782 /* Resources */, 186 | ); 187 | buildRules = ( 188 | ); 189 | dependencies = ( 190 | 607FACE71AFB9204008FA782 /* PBXTargetDependency */, 191 | ); 192 | name = JXWebViewController_Tests; 193 | productName = Tests; 194 | productReference = 607FACE51AFB9204008FA782 /* JXWebViewController_Tests.xctest */; 195 | productType = "com.apple.product-type.bundle.unit-test"; 196 | }; 197 | /* End PBXNativeTarget section */ 198 | 199 | /* Begin PBXProject section */ 200 | 607FACC81AFB9204008FA782 /* Project object */ = { 201 | isa = PBXProject; 202 | attributes = { 203 | LastSwiftUpdateCheck = 0830; 204 | LastUpgradeCheck = 1020; 205 | ORGANIZATIONNAME = CocoaPods; 206 | TargetAttributes = { 207 | 607FACCF1AFB9204008FA782 = { 208 | CreatedOnToolsVersion = 6.3.1; 209 | LastSwiftMigration = 1020; 210 | }; 211 | 607FACE41AFB9204008FA782 = { 212 | CreatedOnToolsVersion = 6.3.1; 213 | LastSwiftMigration = 1020; 214 | TestTargetID = 607FACCF1AFB9204008FA782; 215 | }; 216 | }; 217 | }; 218 | buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "JXWebViewController" */; 219 | compatibilityVersion = "Xcode 3.2"; 220 | developmentRegion = en; 221 | hasScannedForEncodings = 0; 222 | knownRegions = ( 223 | en, 224 | Base, 225 | ); 226 | mainGroup = 607FACC71AFB9204008FA782; 227 | productRefGroup = 607FACD11AFB9204008FA782 /* Products */; 228 | projectDirPath = ""; 229 | projectRoot = ""; 230 | targets = ( 231 | 607FACCF1AFB9204008FA782 /* JXWebViewController_Example */, 232 | 607FACE41AFB9204008FA782 /* JXWebViewController_Tests */, 233 | ); 234 | }; 235 | /* End PBXProject section */ 236 | 237 | /* Begin PBXResourcesBuildPhase section */ 238 | 607FACCE1AFB9204008FA782 /* Resources */ = { 239 | isa = PBXResourcesBuildPhase; 240 | buildActionMask = 2147483647; 241 | files = ( 242 | 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */, 243 | 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */, 244 | ); 245 | runOnlyForDeploymentPostprocessing = 0; 246 | }; 247 | 607FACE31AFB9204008FA782 /* Resources */ = { 248 | isa = PBXResourcesBuildPhase; 249 | buildActionMask = 2147483647; 250 | files = ( 251 | ); 252 | runOnlyForDeploymentPostprocessing = 0; 253 | }; 254 | /* End PBXResourcesBuildPhase section */ 255 | 256 | /* Begin PBXShellScriptBuildPhase section */ 257 | 310DE011C0834D1D43463F1D /* [CP] Check Pods Manifest.lock */ = { 258 | isa = PBXShellScriptBuildPhase; 259 | buildActionMask = 2147483647; 260 | files = ( 261 | ); 262 | inputPaths = ( 263 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 264 | "${PODS_ROOT}/Manifest.lock", 265 | ); 266 | name = "[CP] Check Pods Manifest.lock"; 267 | outputPaths = ( 268 | "$(DERIVED_FILE_DIR)/Pods-JXWebViewController_Example-checkManifestLockResult.txt", 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | shellPath = /bin/sh; 272 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 273 | showEnvVarsInLog = 0; 274 | }; 275 | 60262E68B106406EF8AA04B4 /* [CP] Check Pods Manifest.lock */ = { 276 | isa = PBXShellScriptBuildPhase; 277 | buildActionMask = 2147483647; 278 | files = ( 279 | ); 280 | inputPaths = ( 281 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 282 | "${PODS_ROOT}/Manifest.lock", 283 | ); 284 | name = "[CP] Check Pods Manifest.lock"; 285 | outputPaths = ( 286 | "$(DERIVED_FILE_DIR)/Pods-JXWebViewController_Tests-checkManifestLockResult.txt", 287 | ); 288 | runOnlyForDeploymentPostprocessing = 0; 289 | shellPath = /bin/sh; 290 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 291 | showEnvVarsInLog = 0; 292 | }; 293 | EFAC6D66D473C4689B4A8582 /* [CP] Embed Pods Frameworks */ = { 294 | isa = PBXShellScriptBuildPhase; 295 | buildActionMask = 2147483647; 296 | files = ( 297 | ); 298 | inputPaths = ( 299 | "${PODS_ROOT}/Target Support Files/Pods-JXWebViewController_Example/Pods-JXWebViewController_Example-frameworks.sh", 300 | "${BUILT_PRODUCTS_DIR}/JXWebViewController/JXWebViewController.framework", 301 | ); 302 | name = "[CP] Embed Pods Frameworks"; 303 | outputPaths = ( 304 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/JXWebViewController.framework", 305 | ); 306 | runOnlyForDeploymentPostprocessing = 0; 307 | shellPath = /bin/sh; 308 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-JXWebViewController_Example/Pods-JXWebViewController_Example-frameworks.sh\"\n"; 309 | showEnvVarsInLog = 0; 310 | }; 311 | /* End PBXShellScriptBuildPhase section */ 312 | 313 | /* Begin PBXSourcesBuildPhase section */ 314 | 607FACCC1AFB9204008FA782 /* Sources */ = { 315 | isa = PBXSourcesBuildPhase; 316 | buildActionMask = 2147483647; 317 | files = ( 318 | 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */, 319 | ); 320 | runOnlyForDeploymentPostprocessing = 0; 321 | }; 322 | 607FACE11AFB9204008FA782 /* Sources */ = { 323 | isa = PBXSourcesBuildPhase; 324 | buildActionMask = 2147483647; 325 | files = ( 326 | 607FACEC1AFB9204008FA782 /* Tests.swift in Sources */, 327 | ); 328 | runOnlyForDeploymentPostprocessing = 0; 329 | }; 330 | /* End PBXSourcesBuildPhase section */ 331 | 332 | /* Begin PBXTargetDependency section */ 333 | 607FACE71AFB9204008FA782 /* PBXTargetDependency */ = { 334 | isa = PBXTargetDependency; 335 | target = 607FACCF1AFB9204008FA782 /* JXWebViewController_Example */; 336 | targetProxy = 607FACE61AFB9204008FA782 /* PBXContainerItemProxy */; 337 | }; 338 | /* End PBXTargetDependency section */ 339 | 340 | /* Begin PBXVariantGroup section */ 341 | 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */ = { 342 | isa = PBXVariantGroup; 343 | children = ( 344 | 607FACDF1AFB9204008FA782 /* Base */, 345 | ); 346 | name = LaunchScreen.xib; 347 | sourceTree = ""; 348 | }; 349 | /* End PBXVariantGroup section */ 350 | 351 | /* Begin XCBuildConfiguration section */ 352 | 607FACED1AFB9204008FA782 /* Debug */ = { 353 | isa = XCBuildConfiguration; 354 | buildSettings = { 355 | ALWAYS_SEARCH_USER_PATHS = NO; 356 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 357 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 358 | CLANG_CXX_LIBRARY = "libc++"; 359 | CLANG_ENABLE_MODULES = YES; 360 | CLANG_ENABLE_OBJC_ARC = YES; 361 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 362 | CLANG_WARN_BOOL_CONVERSION = YES; 363 | CLANG_WARN_COMMA = YES; 364 | CLANG_WARN_CONSTANT_CONVERSION = YES; 365 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 366 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 367 | CLANG_WARN_EMPTY_BODY = YES; 368 | CLANG_WARN_ENUM_CONVERSION = YES; 369 | CLANG_WARN_INFINITE_RECURSION = YES; 370 | CLANG_WARN_INT_CONVERSION = YES; 371 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 372 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 373 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 374 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 375 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 376 | CLANG_WARN_STRICT_PROTOTYPES = YES; 377 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 378 | CLANG_WARN_UNREACHABLE_CODE = YES; 379 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 380 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 381 | COPY_PHASE_STRIP = NO; 382 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 383 | ENABLE_STRICT_OBJC_MSGSEND = YES; 384 | ENABLE_TESTABILITY = YES; 385 | GCC_C_LANGUAGE_STANDARD = gnu99; 386 | GCC_DYNAMIC_NO_PIC = NO; 387 | GCC_NO_COMMON_BLOCKS = YES; 388 | GCC_OPTIMIZATION_LEVEL = 0; 389 | GCC_PREPROCESSOR_DEFINITIONS = ( 390 | "DEBUG=1", 391 | "$(inherited)", 392 | ); 393 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 394 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 395 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 396 | GCC_WARN_UNDECLARED_SELECTOR = YES; 397 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 398 | GCC_WARN_UNUSED_FUNCTION = YES; 399 | GCC_WARN_UNUSED_VARIABLE = YES; 400 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 401 | MTL_ENABLE_DEBUG_INFO = YES; 402 | ONLY_ACTIVE_ARCH = YES; 403 | SDKROOT = iphoneos; 404 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 405 | }; 406 | name = Debug; 407 | }; 408 | 607FACEE1AFB9204008FA782 /* Release */ = { 409 | isa = XCBuildConfiguration; 410 | buildSettings = { 411 | ALWAYS_SEARCH_USER_PATHS = NO; 412 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 413 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 414 | CLANG_CXX_LIBRARY = "libc++"; 415 | CLANG_ENABLE_MODULES = YES; 416 | CLANG_ENABLE_OBJC_ARC = YES; 417 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 418 | CLANG_WARN_BOOL_CONVERSION = YES; 419 | CLANG_WARN_COMMA = YES; 420 | CLANG_WARN_CONSTANT_CONVERSION = YES; 421 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 422 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 423 | CLANG_WARN_EMPTY_BODY = YES; 424 | CLANG_WARN_ENUM_CONVERSION = YES; 425 | CLANG_WARN_INFINITE_RECURSION = YES; 426 | CLANG_WARN_INT_CONVERSION = YES; 427 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 428 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 429 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 430 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 431 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 432 | CLANG_WARN_STRICT_PROTOTYPES = YES; 433 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 434 | CLANG_WARN_UNREACHABLE_CODE = YES; 435 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 436 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 437 | COPY_PHASE_STRIP = NO; 438 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 439 | ENABLE_NS_ASSERTIONS = NO; 440 | ENABLE_STRICT_OBJC_MSGSEND = YES; 441 | GCC_C_LANGUAGE_STANDARD = gnu99; 442 | GCC_NO_COMMON_BLOCKS = YES; 443 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 444 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 445 | GCC_WARN_UNDECLARED_SELECTOR = YES; 446 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 447 | GCC_WARN_UNUSED_FUNCTION = YES; 448 | GCC_WARN_UNUSED_VARIABLE = YES; 449 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 450 | MTL_ENABLE_DEBUG_INFO = NO; 451 | SDKROOT = iphoneos; 452 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 453 | VALIDATE_PRODUCT = YES; 454 | }; 455 | name = Release; 456 | }; 457 | 607FACF01AFB9204008FA782 /* Debug */ = { 458 | isa = XCBuildConfiguration; 459 | baseConfigurationReference = 7E0E5E57486639E73027E1A8 /* Pods-JXWebViewController_Example.debug.xcconfig */; 460 | buildSettings = { 461 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 462 | INFOPLIST_FILE = JXWebViewController/Info.plist; 463 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 464 | MODULE_NAME = ExampleApp; 465 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; 466 | PRODUCT_NAME = "$(TARGET_NAME)"; 467 | SWIFT_VERSION = 5.0; 468 | }; 469 | name = Debug; 470 | }; 471 | 607FACF11AFB9204008FA782 /* Release */ = { 472 | isa = XCBuildConfiguration; 473 | baseConfigurationReference = 7386D403B0077938FBBB54BE /* Pods-JXWebViewController_Example.release.xcconfig */; 474 | buildSettings = { 475 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 476 | INFOPLIST_FILE = JXWebViewController/Info.plist; 477 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 478 | MODULE_NAME = ExampleApp; 479 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; 480 | PRODUCT_NAME = "$(TARGET_NAME)"; 481 | SWIFT_VERSION = 5.0; 482 | }; 483 | name = Release; 484 | }; 485 | 607FACF31AFB9204008FA782 /* Debug */ = { 486 | isa = XCBuildConfiguration; 487 | baseConfigurationReference = 4B65C0659F9544C6F53052FA /* Pods-JXWebViewController_Tests.debug.xcconfig */; 488 | buildSettings = { 489 | FRAMEWORK_SEARCH_PATHS = ( 490 | "$(SDKROOT)/Developer/Library/Frameworks", 491 | "$(inherited)", 492 | ); 493 | GCC_PREPROCESSOR_DEFINITIONS = ( 494 | "DEBUG=1", 495 | "$(inherited)", 496 | ); 497 | INFOPLIST_FILE = Tests/Info.plist; 498 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 499 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; 500 | PRODUCT_NAME = "$(TARGET_NAME)"; 501 | SWIFT_VERSION = 5.0; 502 | }; 503 | name = Debug; 504 | }; 505 | 607FACF41AFB9204008FA782 /* Release */ = { 506 | isa = XCBuildConfiguration; 507 | baseConfigurationReference = 53FF8E79B3D8202D6D5706F6 /* Pods-JXWebViewController_Tests.release.xcconfig */; 508 | buildSettings = { 509 | FRAMEWORK_SEARCH_PATHS = ( 510 | "$(SDKROOT)/Developer/Library/Frameworks", 511 | "$(inherited)", 512 | ); 513 | INFOPLIST_FILE = Tests/Info.plist; 514 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 515 | PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)"; 516 | PRODUCT_NAME = "$(TARGET_NAME)"; 517 | SWIFT_VERSION = 5.0; 518 | }; 519 | name = Release; 520 | }; 521 | /* End XCBuildConfiguration section */ 522 | 523 | /* Begin XCConfigurationList section */ 524 | 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "JXWebViewController" */ = { 525 | isa = XCConfigurationList; 526 | buildConfigurations = ( 527 | 607FACED1AFB9204008FA782 /* Debug */, 528 | 607FACEE1AFB9204008FA782 /* Release */, 529 | ); 530 | defaultConfigurationIsVisible = 0; 531 | defaultConfigurationName = Release; 532 | }; 533 | 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "JXWebViewController_Example" */ = { 534 | isa = XCConfigurationList; 535 | buildConfigurations = ( 536 | 607FACF01AFB9204008FA782 /* Debug */, 537 | 607FACF11AFB9204008FA782 /* Release */, 538 | ); 539 | defaultConfigurationIsVisible = 0; 540 | defaultConfigurationName = Release; 541 | }; 542 | 607FACF21AFB9204008FA782 /* Build configuration list for PBXNativeTarget "JXWebViewController_Tests" */ = { 543 | isa = XCConfigurationList; 544 | buildConfigurations = ( 545 | 607FACF31AFB9204008FA782 /* Debug */, 546 | 607FACF41AFB9204008FA782 /* Release */, 547 | ); 548 | defaultConfigurationIsVisible = 0; 549 | defaultConfigurationName = Release; 550 | }; 551 | /* End XCConfigurationList section */ 552 | }; 553 | rootObject = 607FACC81AFB9204008FA782 /* Project object */; 554 | } 555 | --------------------------------------------------------------------------------