├── mhwebvc.gif
├── Example
├── Assets.xcassets
│ ├── Contents.json
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── ViewController.swift
├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
├── Info.plist
└── AppDelegate.swift
├── MHWebViewController
├── Assets.xcassets
│ ├── Contents.json
│ └── close_button.imageset
│ │ ├── baseline_close_black_24pt_1x.png
│ │ ├── baseline_close_black_24pt_2x.png
│ │ ├── baseline_close_black_24pt_3x.png
│ │ └── Contents.json
└── Sources
│ ├── UIViewController_Extensions.swift
│ ├── UView_Extensions.swift
│ └── MHWebViewController.swift
├── .gitignore
├── Example.xcodeproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
├── xcshareddata
│ └── xcschemes
│ │ └── Example.xcscheme
└── project.pbxproj
├── Example.xcworkspace
├── contents.xcworkspacedata
└── xcshareddata
│ └── IDEWorkspaceChecks.plist
├── Podfile.lock
├── Podfile
├── .travis.yml
├── MHWebViewController.podspec
├── ExampleTests
├── Info.plist
└── MHWebViewControllerTests.swift
├── LICENSE
└── README.md
/mhwebvc.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelhenry/MHWebViewController/HEAD/mhwebvc.gif
--------------------------------------------------------------------------------
/Example/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/MHWebViewController/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | DerivedData/*
2 | *.xcodeproj/xcuserdata
3 | *.xcodeproj/project.xcworkspace/xcuserdata
4 | Pods/*
5 | *.xcworkspace/xcuserdata
6 |
--------------------------------------------------------------------------------
/MHWebViewController/Assets.xcassets/close_button.imageset/baseline_close_black_24pt_1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelhenry/MHWebViewController/HEAD/MHWebViewController/Assets.xcassets/close_button.imageset/baseline_close_black_24pt_1x.png
--------------------------------------------------------------------------------
/MHWebViewController/Assets.xcassets/close_button.imageset/baseline_close_black_24pt_2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelhenry/MHWebViewController/HEAD/MHWebViewController/Assets.xcassets/close_button.imageset/baseline_close_black_24pt_2x.png
--------------------------------------------------------------------------------
/MHWebViewController/Assets.xcassets/close_button.imageset/baseline_close_black_24pt_3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/michaelhenry/MHWebViewController/HEAD/MHWebViewController/Assets.xcassets/close_button.imageset/baseline_close_black_24pt_3x.png
--------------------------------------------------------------------------------
/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Example.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Example.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Example.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - MHWebViewController (1.0.0)
3 |
4 | DEPENDENCIES:
5 | - MHWebViewController (from `./`)
6 |
7 | EXTERNAL SOURCES:
8 | MHWebViewController:
9 | :path: "./"
10 |
11 | SPEC CHECKSUMS:
12 | MHWebViewController: adb9f1c23a36b67be67a15bd02d8eb1175833e3e
13 |
14 | PODFILE CHECKSUM: 62ffae2d66a52851aff63ab6c8ab8685b22dc1f7
15 |
16 | COCOAPODS: 1.6.1
17 |
--------------------------------------------------------------------------------
/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment the next line to define a global platform for your project
2 | platform :ios, '9.0'
3 |
4 | target 'Example' do
5 | # Comment the next line if you're not using Swift and don't want to use dynamic frameworks
6 | use_frameworks!
7 |
8 | # Pods for MHWebViewController
9 | pod 'MHWebViewController', :path => './'
10 |
11 | target 'ExampleTests' do
12 | inherit! :search_paths
13 | # Pods for testing
14 | end
15 |
16 | end
17 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | osx_image: xcode11
2 | language: objective-c
3 | jobs:
4 | include:
5 | - stage: Testing
6 | before_install:
7 | - gem install cocoapods
8 | script:
9 | - pod install
10 | - xcodebuild test -workspace Example.xcworkspace -scheme Example -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=11.3,name=iPhone X' -quiet
11 | - stage: deploying to cocoapods
12 | before_install:
13 | - echo $TRAVIS_TAG
14 | - export CURRENT_VERSION=$TRAVIS_TAG
15 | - gem install cocoapods
16 | script:
17 | - pod lib lint --allow-warnings
18 | - pod trunk push --allow-warnings
19 | if: tag IS present
--------------------------------------------------------------------------------
/MHWebViewController/Assets.xcassets/close_button.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images": [
3 | {
4 | "filename": "baseline_close_black_24pt_1x.png",
5 | "idiom": "universal",
6 | "scale": "1x"
7 | },
8 | {
9 | "filename": "baseline_close_black_24pt_2x.png",
10 | "idiom": "universal",
11 | "scale": "2x"
12 | },
13 | {
14 | "filename": "baseline_close_black_24pt_3x.png",
15 | "idiom": "universal",
16 | "scale": "3x"
17 | }
18 | ],
19 | "info": {
20 | "author": "xcode",
21 | "template-rendering-intent": "template",
22 | "version": 1
23 | }
24 | }
--------------------------------------------------------------------------------
/MHWebViewController.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = 'MHWebViewController'
3 | s.version = ENV["CURRENT_VERSION"] || '1.0.0'
4 | s.platform = :ios
5 | s.summary = 'An Instagram inspired Web View Controller.'
6 | s.homepage = 'https://github.com/michaelhenry/MHWebViewController'
7 | s.author = { 'Michael Henry Pantaleon' => 'me@iamkel.net' }
8 | s.source = {
9 | :git => 'https://github.com/michaelhenry/MHWebViewController.git',
10 | :tag => s.version.to_s
11 | }
12 | s.source_files = 'MHWebViewController/Sources/**/*'
13 | s.ios.deployment_target = '9.0'
14 | s.frameworks = 'WebKit'
15 | s.license = { :type => 'MIT', :file => 'LICENSE' }
16 | s.swift_version = '4.2'
17 | s.resources = 'MHWebViewController/*.xcassets'
18 | end
19 |
--------------------------------------------------------------------------------
/ExampleTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
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 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/MHWebViewController/Sources/UIViewController_Extensions.swift:
--------------------------------------------------------------------------------
1 | //
2 | // UIViewController_Extensions.swift
3 | // MHWebViewController
4 | //
5 | // Created by Michael Henry Pantaleon on 2019/09/30.
6 | //
7 |
8 | import UIKit
9 |
10 | public extension UIViewController {
11 |
12 | // Shortcuts
13 | @objc
14 | func present(urlRequest: URLRequest, titleHidden:Bool = false, completion: (() -> Void)? = nil) {
15 | let web = MHWebViewController()
16 | web.request = urlRequest
17 | web.modalPresentationStyle = .overCurrentContext
18 | web.titleHidden = titleHidden
19 | present(web, animated: true, completion: completion)
20 | }
21 |
22 | @objc
23 | func present(url: URL, titleHidden:Bool = false, completion: (() -> Void)? = nil) {
24 | let urlRequest = URLRequest(url: url)
25 | present(urlRequest: urlRequest, titleHidden: titleHidden, completion: completion)
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Example/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // MHWebViewController
4 | //
5 | // Created by Michael Henry Pantaleon on 2019/05/05.
6 | // Copyright © 2019 iamkel.net. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import MHWebViewController
11 |
12 | class ViewController: UIViewController {
13 |
14 | override func viewDidLoad() {
15 | super.viewDidLoad()
16 |
17 | let openButton = UIButton(type: .custom)
18 | let viewFrame = view.bounds
19 | openButton.frame = viewFrame
20 | view.addSubview(openButton)
21 | openButton.setTitle("Show browser", for: .normal)
22 | openButton.setTitleColor(UIColor.black, for: .normal)
23 | openButton.addTarget(self, action: #selector(showBrowser(_:)), for: .touchUpInside)
24 | openButton.autoresizingMask = [.flexibleHeight, .flexibleWidth]
25 | }
26 |
27 | @objc func showBrowser(_ sender:UIButton) {
28 | present(url: URL(string: "https://github.com")!, completion: nil)
29 | }
30 | }
31 |
32 |
--------------------------------------------------------------------------------
/ExampleTests/MHWebViewControllerTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MHWebViewControllerTests.swift
3 | // MHWebViewControllerTests
4 | //
5 | // Created by Michael Henry Pantaleon on 2019/05/05.
6 | // Copyright © 2019 iamkel.net. All rights reserved.
7 | //
8 |
9 | import XCTest
10 | @testable import MHWebViewController
11 |
12 | class MHWebViewControllerTests: XCTestCase {
13 |
14 | override func setUp() {
15 | // Put setup code here. This method is called before the invocation of each test method in the class.
16 | }
17 |
18 | override func tearDown() {
19 | // Put teardown code here. This method is called after the invocation of each test method in the class.
20 | }
21 |
22 | func testExample() {
23 | // This is an example of a functional test case.
24 | // Use XCTAssert and related functions to verify your tests produce the correct results.
25 | }
26 |
27 | func testPerformanceExample() {
28 | // This is an example of a performance test case.
29 | self.measure {
30 | // Put the code you want to measure the time of here.
31 | }
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2019 Michael Henry Pantaleon
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.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MHWebViewController
2 |
3 |
4 | [](https://travis-ci.org/michaelhenry/MHWebViewController) [](http://cocoapods.org/pods/MHWebViewController) [](http://cocoapods.org/pods/MHWebViewController) [](http://cocoapods.org/pods/MHWebViewController)
5 |
6 | 
7 |
8 | An Instagram inspired Web View Controller.
9 |
10 | ## How to Install
11 |
12 | ### Using Cocoapods, on your Podfile:
13 | ```ruby
14 | target 'MyApp' do
15 | pod 'MHWebViewController', '~> 1.0'
16 | end
17 | ```
18 |
19 | ## How to use
20 |
21 | ### Using URL
22 | ```swift
23 | import MHWebViewController
24 |
25 | present(url: URL(string: "https://iamkel.net")!, completion: nil)
26 | ```
27 |
28 | ### Using URLRequest
29 | ```swift
30 | import MHWebViewController
31 |
32 | present(urlRequest: URLRequest(url: URL(string: "https://iamkel.net")!), completion: nil)
33 | ```
34 |
--------------------------------------------------------------------------------
/Example/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/MHWebViewController/Sources/UView_Extensions.swift:
--------------------------------------------------------------------------------
1 | //
2 | // UView_Extensions.swift
3 | // MHWebViewController
4 | //
5 | // Created by Michael Henry Pantaleon on 2019/09/30.
6 | //
7 |
8 | import UIKit
9 |
10 | extension UIView {
11 |
12 | var safeTopAnchor: NSLayoutYAxisAnchor {
13 | if #available(iOS 11.0, *) {
14 | return self.safeAreaLayoutGuide.topAnchor
15 | }
16 | return self.topAnchor
17 | }
18 |
19 | var safeLeadingAnchor: NSLayoutXAxisAnchor {
20 | if #available(iOS 11.0, *){
21 | return self.safeAreaLayoutGuide.leadingAnchor
22 | }
23 | return self.leadingAnchor
24 | }
25 |
26 | var safeTrailingtAnchor: NSLayoutXAxisAnchor {
27 | if #available(iOS 11.0, *){
28 | return self.safeAreaLayoutGuide.trailingAnchor
29 | }
30 | return self.trailingAnchor
31 | }
32 |
33 | var safeBottomAnchor: NSLayoutYAxisAnchor {
34 | if #available(iOS 11.0, *) {
35 | return self.safeAreaLayoutGuide.bottomAnchor
36 | }
37 | return self.bottomAnchor
38 | }
39 |
40 | func bindFrameToSuperviewBounds() {
41 | guard let superview = self.superview else {
42 | print("Error! `superview` was nil – call `addSubview(view: UIView)`")
43 | return
44 | }
45 |
46 | self.translatesAutoresizingMaskIntoConstraints = false
47 | self.topAnchor.constraint(
48 | equalTo: superview.topAnchor, constant: 0).isActive = true
49 | self.bottomAnchor.constraint(
50 | equalTo: superview.bottomAnchor, constant: 0).isActive = true
51 | self.leadingAnchor.constraint(
52 | equalTo: superview.leadingAnchor, constant: 0).isActive = true
53 | self.trailingAnchor.constraint(
54 | equalTo: superview.trailingAnchor, constant: 0).isActive = true
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Example/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
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 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | NSAppTransportSecurity
28 |
29 | NSAllowsArbitraryLoads
30 |
31 |
32 | UIRequiredDeviceCapabilities
33 |
34 | armv7
35 |
36 | UISupportedInterfaceOrientations
37 |
38 | UIInterfaceOrientationPortrait
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UISupportedInterfaceOrientations~ipad
43 |
44 | UIInterfaceOrientationPortrait
45 | UIInterfaceOrientationPortraitUpsideDown
46 | UIInterfaceOrientationLandscapeLeft
47 | UIInterfaceOrientationLandscapeRight
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/Example/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/Example/Assets.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" : "ipad",
45 | "size" : "20x20",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "20x20",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "29x29",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "29x29",
61 | "scale" : "2x"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "size" : "40x40",
66 | "scale" : "1x"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "size" : "40x40",
71 | "scale" : "2x"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "size" : "76x76",
76 | "scale" : "1x"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "size" : "76x76",
81 | "scale" : "2x"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "size" : "83.5x83.5",
86 | "scale" : "2x"
87 | },
88 | {
89 | "idiom" : "ios-marketing",
90 | "size" : "1024x1024",
91 | "scale" : "1x"
92 | }
93 | ],
94 | "info" : {
95 | "version" : 1,
96 | "author" : "xcode"
97 | }
98 | }
--------------------------------------------------------------------------------
/Example/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // MHWebViewController
4 | //
5 | // Created by Michael Henry Pantaleon on 2019/05/05.
6 | // Copyright © 2019 iamkel.net. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
17 | // Override point for customization after application launch.
18 | return true
19 | }
20 |
21 | func applicationWillResignActive(_ application: UIApplication) {
22 | // 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.
23 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
24 | }
25 |
26 | func applicationDidEnterBackground(_ application: UIApplication) {
27 | // 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.
28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
29 | }
30 |
31 | func applicationWillEnterForeground(_ application: UIApplication) {
32 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
33 | }
34 |
35 | func applicationDidBecomeActive(_ application: UIApplication) {
36 | // 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.
37 | }
38 |
39 | func applicationWillTerminate(_ application: UIApplication) {
40 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
41 | }
42 | }
43 |
44 |
45 |
--------------------------------------------------------------------------------
/Example.xcodeproj/xcshareddata/xcschemes/Example.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
53 |
54 |
64 |
66 |
72 |
73 |
74 |
75 |
76 |
77 |
83 |
85 |
91 |
92 |
93 |
94 |
96 |
97 |
100 |
101 |
102 |
--------------------------------------------------------------------------------
/MHWebViewController/Sources/MHWebViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MHWebViewController.swift
3 | // MHWebViewController
4 | //
5 | // Created by Michael Henry Pantaleon on 2019/05/05.
6 | // Copyright © 2019 iamkel.net. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import WebKit
11 |
12 | public class MHWebViewController:UIViewController {
13 |
14 | enum WebViewKeyPath:String {
15 | case estimatedProgress
16 | case title
17 | }
18 |
19 | private lazy var container = UIView(frame: CGRect.zero)
20 | private lazy var progressView = UIProgressView(progressViewStyle: .bar)
21 | public private(set) lazy var webView:WKWebView = WKWebView(frame: CGRect.zero)
22 |
23 | private lazy var toolbar:UIView = {
24 | let v = UIView(frame: CGRect.zero)
25 | v.isUserInteractionEnabled = true
26 | v.heightAnchor.constraint(equalToConstant: 44.0).isActive = true
27 | v.translatesAutoresizingMaskIntoConstraints = false
28 |
29 | let blurEffect = UIBlurEffect(style: .light)
30 | let blurEffectView = UIVisualEffectView(effect: blurEffect)
31 | v.addSubview(blurEffectView)
32 | blurEffectView.bindFrameToSuperviewBounds()
33 | return v
34 | }()
35 |
36 | private lazy var titleLabel:UILabel = {
37 | let lbl = UILabel(frame: CGRect(x: 0.0, y: 0.0, width: 250.0, height: 16.0))
38 | lbl.adjustsFontSizeToFitWidth = true
39 | lbl.minimumScaleFactor = 0.9
40 | lbl.textAlignment = .center
41 | lbl.font = UIFont.boldSystemFont(ofSize: 16)
42 | return lbl
43 | }()
44 |
45 | private lazy var urlLabel:UILabel = {
46 | let lbl = UILabel(frame: CGRect(x: 0.0, y: 0.0, width: 250.0, height: 10.0))
47 | lbl.adjustsFontSizeToFitWidth = true
48 | lbl.minimumScaleFactor = 0.9
49 | lbl.textAlignment = .center
50 | lbl.font = UIFont.systemFont(ofSize: 10)
51 | return lbl
52 | }()
53 |
54 | private let topMargin:CGFloat = 10.0
55 | private var lastLocation:CGPoint = .zero
56 | public var request:URLRequest!
57 |
58 | public override var title: String? {
59 | didSet {
60 | titleLabel.text = title
61 | }
62 | }
63 |
64 | var detail:String? {
65 | didSet {
66 | urlLabel.text = detail
67 | }
68 | }
69 |
70 | public var titleHidden:Bool = false
71 |
72 | override public func loadView() {
73 | super.loadView()
74 | setupMainLayout()
75 | setupToolbar()
76 | }
77 |
78 | override public func viewDidLoad() {
79 | super.viewDidLoad()
80 | addPanGestureRecognizer()
81 | titleLabel.text = titleHidden ? "" : NSLocalizedString(
82 | "Loading...", comment: "the loading text at the top")
83 | webView.navigationDelegate = self
84 | webView.load(request)
85 | }
86 |
87 | public override func viewDidAppear(_ animated: Bool) {
88 | super.viewDidAppear(animated)
89 | addWebViewObservers()
90 | }
91 |
92 | public override func viewDidDisappear(_ animated: Bool) {
93 | super.viewDidDisappear(animated)
94 | removeWebViewObservers()
95 | }
96 |
97 | private func setupToolbar() {
98 | // toolbar
99 | let closeButton = createImageButton(imageName: "close_button")
100 | closeButton.addTarget(self, action: #selector(dismissMe(_:)), for: .touchUpInside)
101 | closeButton.tintColor = .gray
102 | closeButton.widthAnchor.constraint(equalTo: closeButton.heightAnchor).isActive = true
103 |
104 | let titleStackView = UIStackView(arrangedSubviews: [titleLabel, urlLabel])
105 | titleStackView.axis = .vertical
106 |
107 | let toolbarStackView = UIStackView(arrangedSubviews: [closeButton, titleStackView])
108 | toolbarStackView.spacing = 2.0
109 | toolbarStackView.axis = .horizontal
110 | toolbar.addSubview(toolbarStackView)
111 |
112 | toolbarStackView.translatesAutoresizingMaskIntoConstraints = false
113 | toolbarStackView.topAnchor.constraint(equalTo: toolbar.topAnchor, constant: 5).isActive = true
114 | toolbarStackView.leadingAnchor.constraint(equalTo: toolbar.leadingAnchor, constant: 5).isActive = true
115 | toolbarStackView.bottomAnchor.constraint(equalTo: toolbar.bottomAnchor, constant: -5).isActive = true
116 | toolbarStackView.trailingAnchor.constraint(equalTo: toolbar.trailingAnchor, constant: -49).isActive = true
117 | }
118 |
119 | private func createImageButton(imageName: String) -> UIButton {
120 | guard let closeImage = UIImage(
121 | named: imageName,
122 | in: Bundle(for: MHWebViewController.self),
123 | compatibleWith: nil) else { fatalError("No image named \(imageName) in the MHWebViewController.bundle") }
124 | let closeButton = UIButton(type: .custom)
125 | closeButton.setImage(closeImage, for: .normal)
126 | return closeButton
127 | }
128 |
129 | private func setupMainLayout() {
130 | view = UIView()
131 | view.autoresizingMask = [.flexibleHeight, .flexibleWidth]
132 | view.backgroundColor = .clear
133 | view.addSubview(container)
134 | container.translatesAutoresizingMaskIntoConstraints = false
135 | container.topAnchor.constraint(
136 | equalTo: view.safeTopAnchor, constant: topMargin).isActive = true
137 | container.bottomAnchor.constraint(
138 | equalTo: view.bottomAnchor).isActive = true
139 | container.leadingAnchor.constraint(
140 | equalTo: view.safeLeadingAnchor, constant: 0).isActive = true
141 | container.trailingAnchor.constraint(
142 | equalTo: view.safeTrailingtAnchor, constant: 0).isActive = true
143 | container.layer.cornerRadius = 16.0
144 | container.clipsToBounds = true
145 |
146 | let progressViewContainer = UIView()
147 | progressViewContainer.addSubview(progressView)
148 | progressView.bindFrameToSuperviewBounds()
149 | progressViewContainer.heightAnchor.constraint(equalToConstant: 1)
150 | .isActive = true
151 |
152 | let mainStackView = UIStackView(arrangedSubviews: [
153 | toolbar,
154 | progressViewContainer,
155 | webView])
156 |
157 | mainStackView.axis = .vertical
158 | container.addSubview(mainStackView)
159 | mainStackView.bindFrameToSuperviewBounds()
160 | }
161 |
162 | private func addWebViewObservers() {
163 | webView.addObserver(self, forKeyPath: #keyPath(WKWebView.estimatedProgress), options: .new, context: nil)
164 | webView.addObserver(self, forKeyPath: #keyPath(WKWebView.title), options: .new, context: nil)
165 | webView.addObserver(self, forKeyPath: #keyPath(WKWebView.canGoBack), options: .new, context: nil)
166 | webView.addObserver(self, forKeyPath: #keyPath(WKWebView.canGoForward), options: .new, context: nil)
167 | }
168 |
169 | private func removeWebViewObservers() {
170 | webView.removeObserver(self, forKeyPath: #keyPath(WKWebView.estimatedProgress))
171 | webView.removeObserver(self, forKeyPath: #keyPath(WKWebView.title))
172 | webView.removeObserver(self, forKeyPath: #keyPath(WKWebView.canGoBack))
173 | webView.removeObserver(self, forKeyPath: #keyPath(WKWebView.canGoForward))
174 | }
175 |
176 | @objc private func dismissMe(_ sender: UIButton) {
177 | dismiss(completion: nil)
178 | }
179 |
180 | public func dismiss(completion: (() -> Void)? = nil) {
181 | dismiss(animated: true, completion: completion)
182 | }
183 |
184 | override public func observeValue(forKeyPath keyPath: String?, of object: Any?,
185 | change: [NSKeyValueChangeKey : Any]?,
186 | context: UnsafeMutableRawPointer?) {
187 |
188 | switch keyPath {
189 | case WebViewKeyPath.estimatedProgress.rawValue:
190 | progressView.progress = Float(webView.estimatedProgress)
191 | if progressView.progress == 1.0 {
192 | progressView.alpha = 0.0
193 | } else if progressView.alpha != 1.0 {
194 | progressView.alpha = 1.0
195 | }
196 | case WebViewKeyPath.title.rawValue:
197 | title = titleHidden ? "" : webView.title
198 | if !titleHidden, let scheme = webView.url?.scheme,
199 | let host = webView.url?.host {
200 | detail = "\(scheme)://\(host)"
201 | } else {
202 | detail = ""
203 | }
204 | default:
205 | break
206 | }
207 | }
208 | }
209 |
210 | extension MHWebViewController:UIGestureRecognizerDelegate {
211 |
212 | fileprivate func addPanGestureRecognizer() {
213 | let panRecognizer = UIPanGestureRecognizer(
214 | target: self,
215 | action: #selector(self.handlePanning(_:)))
216 | panRecognizer.delegate = self
217 | panRecognizer.maximumNumberOfTouches = 1
218 | panRecognizer.minimumNumberOfTouches = 1
219 | panRecognizer.cancelsTouchesInView = true
220 | toolbar.gestureRecognizers?.forEach {
221 | $0.require(toFail: panRecognizer)
222 | }
223 | toolbar.gestureRecognizers = [panRecognizer]
224 | }
225 |
226 | @objc private func handlePanning(_ gestureRecognizer: UIPanGestureRecognizer?) {
227 |
228 | if gestureRecognizer?.state == .began {
229 | lastLocation = container.center
230 | }
231 |
232 | if gestureRecognizer?.state != .cancelled {
233 | guard let translation: CGPoint = gestureRecognizer?
234 | .translation(in: view) else { return }
235 | container.center = CGPoint(
236 | x: container.center.x,
237 | y: lastLocation.y + translation.y)
238 | }
239 |
240 | if gestureRecognizer?.state == .ended {
241 | if container.frame.origin.y > view.frame.size.height/2.0 {
242 | dismiss()
243 | return
244 | }
245 |
246 | UIView.animate(
247 | withDuration: 0.7,
248 | delay: 0.0,
249 | usingSpringWithDamping: 0.5,
250 | initialSpringVelocity: 0.5,
251 | options: .allowUserInteraction,
252 | animations: {
253 | self.container.center = self.lastLocation
254 | }) { finished in
255 |
256 | }
257 | }
258 | }
259 | }
260 |
261 | extension MHWebViewController:WKNavigationDelegate {
262 |
263 | public func webView(
264 | _ webView: WKWebView,
265 | decidePolicyFor navigationAction: WKNavigationAction,
266 | decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
267 |
268 | switch navigationAction.navigationType {
269 | case .linkActivated:
270 | webView.load(navigationAction.request)
271 | default:
272 | // TODO: Handle other types
273 | break
274 | }
275 | decisionHandler(.allow)
276 | }
277 | }
278 |
--------------------------------------------------------------------------------
/Example.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 51;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 30EDD2969B3DE74CC65DCB99 /* Pods_ExampleTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0009A51296D447FCA409E2C0 /* Pods_ExampleTests.framework */; };
11 | 7DEC628F12E708B596AAFDEF /* Pods_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = ACF1A863AEE87E79B7132901 /* Pods_Example.framework */; };
12 | A6C578FA227DEAAF00D720DD /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6C578F9227DEAAF00D720DD /* AppDelegate.swift */; };
13 | A6C578FC227DEAAF00D720DD /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6C578FB227DEAAF00D720DD /* ViewController.swift */; };
14 | A6C578FF227DEAAF00D720DD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A6C578FD227DEAAF00D720DD /* Main.storyboard */; };
15 | A6C57901227DEAB400D720DD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A6C57900227DEAB400D720DD /* Assets.xcassets */; };
16 | A6C57904227DEAB400D720DD /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A6C57902227DEAB400D720DD /* LaunchScreen.storyboard */; };
17 | A6C5790F227DEAB400D720DD /* MHWebViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = A6C5790E227DEAB400D720DD /* MHWebViewControllerTests.swift */; };
18 | /* End PBXBuildFile section */
19 |
20 | /* Begin PBXContainerItemProxy section */
21 | A6C5790B227DEAB400D720DD /* PBXContainerItemProxy */ = {
22 | isa = PBXContainerItemProxy;
23 | containerPortal = A6C578EE227DEAAF00D720DD /* Project object */;
24 | proxyType = 1;
25 | remoteGlobalIDString = A6C578F5227DEAAF00D720DD;
26 | remoteInfo = MHWebViewController;
27 | };
28 | /* End PBXContainerItemProxy section */
29 |
30 | /* Begin PBXFileReference section */
31 | 0009A51296D447FCA409E2C0 /* Pods_ExampleTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ExampleTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
32 | 1F7D32E1CF6F21BA33588664 /* Pods-ExampleTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ExampleTests.debug.xcconfig"; path = "Target Support Files/Pods-ExampleTests/Pods-ExampleTests.debug.xcconfig"; sourceTree = ""; };
33 | 3B4960932053AFA93EB6D1E3 /* Pods_MHWebViewControllerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MHWebViewControllerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
34 | 3C649F67BB7841B1EAC7EC24 /* Pods-MHWebViewControllerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MHWebViewControllerTests.debug.xcconfig"; path = "Target Support Files/Pods-MHWebViewControllerTests/Pods-MHWebViewControllerTests.debug.xcconfig"; sourceTree = ""; };
35 | 568709FAC4B40356A6A6F4C0 /* Pods-ExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ExampleTests.release.xcconfig"; path = "Target Support Files/Pods-ExampleTests/Pods-ExampleTests.release.xcconfig"; sourceTree = ""; };
36 | 6A5353E0B48453639D2DED20 /* Pods-MHWebViewControllerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MHWebViewControllerTests.release.xcconfig"; path = "Target Support Files/Pods-MHWebViewControllerTests/Pods-MHWebViewControllerTests.release.xcconfig"; sourceTree = ""; };
37 | 726491804E65B4BE8AD1AEF2 /* Pods-MHWebViewController.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MHWebViewController.debug.xcconfig"; path = "Target Support Files/Pods-MHWebViewController/Pods-MHWebViewController.debug.xcconfig"; sourceTree = ""; };
38 | 87277B3EC27143F5AF7C643C /* Pods-Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.debug.xcconfig"; path = "Target Support Files/Pods-Example/Pods-Example.debug.xcconfig"; sourceTree = ""; };
39 | A6C578F6227DEAAF00D720DD /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
40 | A6C578F9227DEAAF00D720DD /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
41 | A6C578FB227DEAAF00D720DD /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
42 | A6C578FE227DEAAF00D720DD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
43 | A6C57900227DEAB400D720DD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
44 | A6C57903227DEAB400D720DD /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
45 | A6C57905227DEAB400D720DD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
46 | A6C5790A227DEAB400D720DD /* ExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
47 | A6C5790E227DEAB400D720DD /* MHWebViewControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MHWebViewControllerTests.swift; sourceTree = ""; };
48 | A6C57910227DEAB400D720DD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
49 | A95A1EFF3532052FF82EF2B2 /* Pods_MHWebViewController.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MHWebViewController.framework; sourceTree = BUILT_PRODUCTS_DIR; };
50 | ACF1A863AEE87E79B7132901 /* Pods_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; };
51 | C43E0DAC2C1AABC7438C2419 /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = ""; };
52 | CCAA90C20DDCB51A5046DC7C /* Pods-MHWebViewController.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MHWebViewController.release.xcconfig"; path = "Target Support Files/Pods-MHWebViewController/Pods-MHWebViewController.release.xcconfig"; sourceTree = ""; };
53 | /* End PBXFileReference section */
54 |
55 | /* Begin PBXFrameworksBuildPhase section */
56 | A6C578F3227DEAAF00D720DD /* Frameworks */ = {
57 | isa = PBXFrameworksBuildPhase;
58 | buildActionMask = 2147483647;
59 | files = (
60 | 7DEC628F12E708B596AAFDEF /* Pods_Example.framework in Frameworks */,
61 | );
62 | runOnlyForDeploymentPostprocessing = 0;
63 | };
64 | A6C57907227DEAB400D720DD /* Frameworks */ = {
65 | isa = PBXFrameworksBuildPhase;
66 | buildActionMask = 2147483647;
67 | files = (
68 | 30EDD2969B3DE74CC65DCB99 /* Pods_ExampleTests.framework in Frameworks */,
69 | );
70 | runOnlyForDeploymentPostprocessing = 0;
71 | };
72 | /* End PBXFrameworksBuildPhase section */
73 |
74 | /* Begin PBXGroup section */
75 | 270894F6925DE22D364168AD /* Pods */ = {
76 | isa = PBXGroup;
77 | children = (
78 | 726491804E65B4BE8AD1AEF2 /* Pods-MHWebViewController.debug.xcconfig */,
79 | CCAA90C20DDCB51A5046DC7C /* Pods-MHWebViewController.release.xcconfig */,
80 | 3C649F67BB7841B1EAC7EC24 /* Pods-MHWebViewControllerTests.debug.xcconfig */,
81 | 6A5353E0B48453639D2DED20 /* Pods-MHWebViewControllerTests.release.xcconfig */,
82 | 87277B3EC27143F5AF7C643C /* Pods-Example.debug.xcconfig */,
83 | C43E0DAC2C1AABC7438C2419 /* Pods-Example.release.xcconfig */,
84 | 1F7D32E1CF6F21BA33588664 /* Pods-ExampleTests.debug.xcconfig */,
85 | 568709FAC4B40356A6A6F4C0 /* Pods-ExampleTests.release.xcconfig */,
86 | );
87 | path = Pods;
88 | sourceTree = "";
89 | };
90 | A6C578ED227DEAAF00D720DD = {
91 | isa = PBXGroup;
92 | children = (
93 | A6C578F8227DEAAF00D720DD /* Example */,
94 | A6C5790D227DEAB400D720DD /* ExampleTests */,
95 | A6C578F7227DEAAF00D720DD /* Products */,
96 | 270894F6925DE22D364168AD /* Pods */,
97 | BD31FFF43A0E8D14FBE3CC01 /* Frameworks */,
98 | );
99 | sourceTree = "";
100 | };
101 | A6C578F7227DEAAF00D720DD /* Products */ = {
102 | isa = PBXGroup;
103 | children = (
104 | A6C578F6227DEAAF00D720DD /* Example.app */,
105 | A6C5790A227DEAB400D720DD /* ExampleTests.xctest */,
106 | );
107 | name = Products;
108 | sourceTree = "";
109 | };
110 | A6C578F8227DEAAF00D720DD /* Example */ = {
111 | isa = PBXGroup;
112 | children = (
113 | A6C578F9227DEAAF00D720DD /* AppDelegate.swift */,
114 | A6C578FB227DEAAF00D720DD /* ViewController.swift */,
115 | A6C578FD227DEAAF00D720DD /* Main.storyboard */,
116 | A6C57900227DEAB400D720DD /* Assets.xcassets */,
117 | A6C57902227DEAB400D720DD /* LaunchScreen.storyboard */,
118 | A6C57905227DEAB400D720DD /* Info.plist */,
119 | );
120 | path = Example;
121 | sourceTree = "";
122 | };
123 | A6C5790D227DEAB400D720DD /* ExampleTests */ = {
124 | isa = PBXGroup;
125 | children = (
126 | A6C5790E227DEAB400D720DD /* MHWebViewControllerTests.swift */,
127 | A6C57910227DEAB400D720DD /* Info.plist */,
128 | );
129 | path = ExampleTests;
130 | sourceTree = "";
131 | };
132 | BD31FFF43A0E8D14FBE3CC01 /* Frameworks */ = {
133 | isa = PBXGroup;
134 | children = (
135 | A95A1EFF3532052FF82EF2B2 /* Pods_MHWebViewController.framework */,
136 | 3B4960932053AFA93EB6D1E3 /* Pods_MHWebViewControllerTests.framework */,
137 | ACF1A863AEE87E79B7132901 /* Pods_Example.framework */,
138 | 0009A51296D447FCA409E2C0 /* Pods_ExampleTests.framework */,
139 | );
140 | name = Frameworks;
141 | sourceTree = "";
142 | };
143 | /* End PBXGroup section */
144 |
145 | /* Begin PBXNativeTarget section */
146 | A6C578F5227DEAAF00D720DD /* Example */ = {
147 | isa = PBXNativeTarget;
148 | buildConfigurationList = A6C57913227DEAB400D720DD /* Build configuration list for PBXNativeTarget "Example" */;
149 | buildPhases = (
150 | 67ED7B5BCDAC89153D0F414E /* [CP] Check Pods Manifest.lock */,
151 | A6C578F2227DEAAF00D720DD /* Sources */,
152 | A6C578F3227DEAAF00D720DD /* Frameworks */,
153 | A6C578F4227DEAAF00D720DD /* Resources */,
154 | 071E14534FD0C98CF339C922 /* [CP] Embed Pods Frameworks */,
155 | );
156 | buildRules = (
157 | );
158 | dependencies = (
159 | );
160 | name = Example;
161 | productName = MHWebViewController;
162 | productReference = A6C578F6227DEAAF00D720DD /* Example.app */;
163 | productType = "com.apple.product-type.application";
164 | };
165 | A6C57909227DEAB400D720DD /* ExampleTests */ = {
166 | isa = PBXNativeTarget;
167 | buildConfigurationList = A6C57916227DEAB400D720DD /* Build configuration list for PBXNativeTarget "ExampleTests" */;
168 | buildPhases = (
169 | B14AE6CA06A3E3904D927C3E /* [CP] Check Pods Manifest.lock */,
170 | A6C57906227DEAB400D720DD /* Sources */,
171 | A6C57907227DEAB400D720DD /* Frameworks */,
172 | A6C57908227DEAB400D720DD /* Resources */,
173 | );
174 | buildRules = (
175 | );
176 | dependencies = (
177 | A6C5790C227DEAB400D720DD /* PBXTargetDependency */,
178 | );
179 | name = ExampleTests;
180 | productName = MHWebViewControllerTests;
181 | productReference = A6C5790A227DEAB400D720DD /* ExampleTests.xctest */;
182 | productType = "com.apple.product-type.bundle.unit-test";
183 | };
184 | /* End PBXNativeTarget section */
185 |
186 | /* Begin PBXProject section */
187 | A6C578EE227DEAAF00D720DD /* Project object */ = {
188 | isa = PBXProject;
189 | attributes = {
190 | LastSwiftUpdateCheck = 1010;
191 | LastUpgradeCheck = 1010;
192 | ORGANIZATIONNAME = iamkel.net;
193 | TargetAttributes = {
194 | A6C578F5227DEAAF00D720DD = {
195 | CreatedOnToolsVersion = 10.1;
196 | LastSwiftMigration = 1100;
197 | };
198 | A6C57909227DEAB400D720DD = {
199 | CreatedOnToolsVersion = 10.1;
200 | LastSwiftMigration = 1100;
201 | TestTargetID = A6C578F5227DEAAF00D720DD;
202 | };
203 | };
204 | };
205 | buildConfigurationList = A6C578F1227DEAAF00D720DD /* Build configuration list for PBXProject "Example" */;
206 | compatibilityVersion = "Xcode 9.3";
207 | developmentRegion = en;
208 | hasScannedForEncodings = 0;
209 | knownRegions = (
210 | en,
211 | Base,
212 | );
213 | mainGroup = A6C578ED227DEAAF00D720DD;
214 | productRefGroup = A6C578F7227DEAAF00D720DD /* Products */;
215 | projectDirPath = "";
216 | projectRoot = "";
217 | targets = (
218 | A6C578F5227DEAAF00D720DD /* Example */,
219 | A6C57909227DEAB400D720DD /* ExampleTests */,
220 | );
221 | };
222 | /* End PBXProject section */
223 |
224 | /* Begin PBXResourcesBuildPhase section */
225 | A6C578F4227DEAAF00D720DD /* Resources */ = {
226 | isa = PBXResourcesBuildPhase;
227 | buildActionMask = 2147483647;
228 | files = (
229 | A6C57904227DEAB400D720DD /* LaunchScreen.storyboard in Resources */,
230 | A6C57901227DEAB400D720DD /* Assets.xcassets in Resources */,
231 | A6C578FF227DEAAF00D720DD /* Main.storyboard in Resources */,
232 | );
233 | runOnlyForDeploymentPostprocessing = 0;
234 | };
235 | A6C57908227DEAB400D720DD /* Resources */ = {
236 | isa = PBXResourcesBuildPhase;
237 | buildActionMask = 2147483647;
238 | files = (
239 | );
240 | runOnlyForDeploymentPostprocessing = 0;
241 | };
242 | /* End PBXResourcesBuildPhase section */
243 |
244 | /* Begin PBXShellScriptBuildPhase section */
245 | 071E14534FD0C98CF339C922 /* [CP] Embed Pods Frameworks */ = {
246 | isa = PBXShellScriptBuildPhase;
247 | buildActionMask = 2147483647;
248 | files = (
249 | );
250 | inputFileListPaths = (
251 | "${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-frameworks-${CONFIGURATION}-input-files.xcfilelist",
252 | );
253 | name = "[CP] Embed Pods Frameworks";
254 | outputFileListPaths = (
255 | "${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-frameworks-${CONFIGURATION}-output-files.xcfilelist",
256 | );
257 | runOnlyForDeploymentPostprocessing = 0;
258 | shellPath = /bin/sh;
259 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Example/Pods-Example-frameworks.sh\"\n";
260 | showEnvVarsInLog = 0;
261 | };
262 | 67ED7B5BCDAC89153D0F414E /* [CP] Check Pods Manifest.lock */ = {
263 | isa = PBXShellScriptBuildPhase;
264 | buildActionMask = 2147483647;
265 | files = (
266 | );
267 | inputFileListPaths = (
268 | );
269 | inputPaths = (
270 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
271 | "${PODS_ROOT}/Manifest.lock",
272 | );
273 | name = "[CP] Check Pods Manifest.lock";
274 | outputFileListPaths = (
275 | );
276 | outputPaths = (
277 | "$(DERIVED_FILE_DIR)/Pods-Example-checkManifestLockResult.txt",
278 | );
279 | runOnlyForDeploymentPostprocessing = 0;
280 | shellPath = /bin/sh;
281 | 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";
282 | showEnvVarsInLog = 0;
283 | };
284 | B14AE6CA06A3E3904D927C3E /* [CP] Check Pods Manifest.lock */ = {
285 | isa = PBXShellScriptBuildPhase;
286 | buildActionMask = 2147483647;
287 | files = (
288 | );
289 | inputFileListPaths = (
290 | );
291 | inputPaths = (
292 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
293 | "${PODS_ROOT}/Manifest.lock",
294 | );
295 | name = "[CP] Check Pods Manifest.lock";
296 | outputFileListPaths = (
297 | );
298 | outputPaths = (
299 | "$(DERIVED_FILE_DIR)/Pods-ExampleTests-checkManifestLockResult.txt",
300 | );
301 | runOnlyForDeploymentPostprocessing = 0;
302 | shellPath = /bin/sh;
303 | 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";
304 | showEnvVarsInLog = 0;
305 | };
306 | /* End PBXShellScriptBuildPhase section */
307 |
308 | /* Begin PBXSourcesBuildPhase section */
309 | A6C578F2227DEAAF00D720DD /* Sources */ = {
310 | isa = PBXSourcesBuildPhase;
311 | buildActionMask = 2147483647;
312 | files = (
313 | A6C578FC227DEAAF00D720DD /* ViewController.swift in Sources */,
314 | A6C578FA227DEAAF00D720DD /* AppDelegate.swift in Sources */,
315 | );
316 | runOnlyForDeploymentPostprocessing = 0;
317 | };
318 | A6C57906227DEAB400D720DD /* Sources */ = {
319 | isa = PBXSourcesBuildPhase;
320 | buildActionMask = 2147483647;
321 | files = (
322 | A6C5790F227DEAB400D720DD /* MHWebViewControllerTests.swift in Sources */,
323 | );
324 | runOnlyForDeploymentPostprocessing = 0;
325 | };
326 | /* End PBXSourcesBuildPhase section */
327 |
328 | /* Begin PBXTargetDependency section */
329 | A6C5790C227DEAB400D720DD /* PBXTargetDependency */ = {
330 | isa = PBXTargetDependency;
331 | target = A6C578F5227DEAAF00D720DD /* Example */;
332 | targetProxy = A6C5790B227DEAB400D720DD /* PBXContainerItemProxy */;
333 | };
334 | /* End PBXTargetDependency section */
335 |
336 | /* Begin PBXVariantGroup section */
337 | A6C578FD227DEAAF00D720DD /* Main.storyboard */ = {
338 | isa = PBXVariantGroup;
339 | children = (
340 | A6C578FE227DEAAF00D720DD /* Base */,
341 | );
342 | name = Main.storyboard;
343 | sourceTree = "";
344 | };
345 | A6C57902227DEAB400D720DD /* LaunchScreen.storyboard */ = {
346 | isa = PBXVariantGroup;
347 | children = (
348 | A6C57903227DEAB400D720DD /* Base */,
349 | );
350 | name = LaunchScreen.storyboard;
351 | sourceTree = "";
352 | };
353 | /* End PBXVariantGroup section */
354 |
355 | /* Begin XCBuildConfiguration section */
356 | A6C57911227DEAB400D720DD /* Debug */ = {
357 | isa = XCBuildConfiguration;
358 | buildSettings = {
359 | ALWAYS_SEARCH_USER_PATHS = NO;
360 | CLANG_ANALYZER_NONNULL = YES;
361 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
362 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
363 | CLANG_CXX_LIBRARY = "libc++";
364 | CLANG_ENABLE_MODULES = YES;
365 | CLANG_ENABLE_OBJC_ARC = YES;
366 | CLANG_ENABLE_OBJC_WEAK = YES;
367 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
368 | CLANG_WARN_BOOL_CONVERSION = YES;
369 | CLANG_WARN_COMMA = YES;
370 | CLANG_WARN_CONSTANT_CONVERSION = YES;
371 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
372 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
373 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
374 | CLANG_WARN_EMPTY_BODY = YES;
375 | CLANG_WARN_ENUM_CONVERSION = YES;
376 | CLANG_WARN_INFINITE_RECURSION = YES;
377 | CLANG_WARN_INT_CONVERSION = YES;
378 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
379 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
380 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
381 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
382 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
383 | CLANG_WARN_STRICT_PROTOTYPES = YES;
384 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
385 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
386 | CLANG_WARN_UNREACHABLE_CODE = YES;
387 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
388 | CODE_SIGN_IDENTITY = "iPhone Developer";
389 | COPY_PHASE_STRIP = NO;
390 | DEBUG_INFORMATION_FORMAT = dwarf;
391 | ENABLE_STRICT_OBJC_MSGSEND = YES;
392 | ENABLE_TESTABILITY = YES;
393 | GCC_C_LANGUAGE_STANDARD = gnu11;
394 | GCC_DYNAMIC_NO_PIC = NO;
395 | GCC_NO_COMMON_BLOCKS = YES;
396 | GCC_OPTIMIZATION_LEVEL = 0;
397 | GCC_PREPROCESSOR_DEFINITIONS = (
398 | "DEBUG=1",
399 | "$(inherited)",
400 | );
401 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
402 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
403 | GCC_WARN_UNDECLARED_SELECTOR = YES;
404 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
405 | GCC_WARN_UNUSED_FUNCTION = YES;
406 | GCC_WARN_UNUSED_VARIABLE = YES;
407 | IPHONEOS_DEPLOYMENT_TARGET = 12.1;
408 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
409 | MTL_FAST_MATH = YES;
410 | ONLY_ACTIVE_ARCH = YES;
411 | SDKROOT = iphoneos;
412 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
413 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
414 | SWIFT_VERSION = 5.0;
415 | };
416 | name = Debug;
417 | };
418 | A6C57912227DEAB400D720DD /* Release */ = {
419 | isa = XCBuildConfiguration;
420 | buildSettings = {
421 | ALWAYS_SEARCH_USER_PATHS = NO;
422 | CLANG_ANALYZER_NONNULL = YES;
423 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
424 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
425 | CLANG_CXX_LIBRARY = "libc++";
426 | CLANG_ENABLE_MODULES = YES;
427 | CLANG_ENABLE_OBJC_ARC = YES;
428 | CLANG_ENABLE_OBJC_WEAK = YES;
429 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
430 | CLANG_WARN_BOOL_CONVERSION = YES;
431 | CLANG_WARN_COMMA = YES;
432 | CLANG_WARN_CONSTANT_CONVERSION = YES;
433 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
434 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
435 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
436 | CLANG_WARN_EMPTY_BODY = YES;
437 | CLANG_WARN_ENUM_CONVERSION = YES;
438 | CLANG_WARN_INFINITE_RECURSION = YES;
439 | CLANG_WARN_INT_CONVERSION = YES;
440 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
441 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
442 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
443 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
444 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
445 | CLANG_WARN_STRICT_PROTOTYPES = YES;
446 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
447 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
448 | CLANG_WARN_UNREACHABLE_CODE = YES;
449 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
450 | CODE_SIGN_IDENTITY = "iPhone Developer";
451 | COPY_PHASE_STRIP = NO;
452 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
453 | ENABLE_NS_ASSERTIONS = NO;
454 | ENABLE_STRICT_OBJC_MSGSEND = YES;
455 | GCC_C_LANGUAGE_STANDARD = gnu11;
456 | GCC_NO_COMMON_BLOCKS = YES;
457 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
458 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
459 | GCC_WARN_UNDECLARED_SELECTOR = YES;
460 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
461 | GCC_WARN_UNUSED_FUNCTION = YES;
462 | GCC_WARN_UNUSED_VARIABLE = YES;
463 | IPHONEOS_DEPLOYMENT_TARGET = 12.1;
464 | MTL_ENABLE_DEBUG_INFO = NO;
465 | MTL_FAST_MATH = YES;
466 | SDKROOT = iphoneos;
467 | SWIFT_COMPILATION_MODE = wholemodule;
468 | SWIFT_OPTIMIZATION_LEVEL = "-O";
469 | SWIFT_VERSION = 5.0;
470 | VALIDATE_PRODUCT = YES;
471 | };
472 | name = Release;
473 | };
474 | A6C57914227DEAB400D720DD /* Debug */ = {
475 | isa = XCBuildConfiguration;
476 | baseConfigurationReference = 87277B3EC27143F5AF7C643C /* Pods-Example.debug.xcconfig */;
477 | buildSettings = {
478 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
479 | CODE_SIGN_STYLE = Automatic;
480 | DEVELOPMENT_TEAM = V542NQW43X;
481 | INFOPLIST_FILE = Example/Info.plist;
482 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
483 | LD_RUNPATH_SEARCH_PATHS = (
484 | "$(inherited)",
485 | "@executable_path/Frameworks",
486 | );
487 | PRODUCT_BUNDLE_IDENTIFIER = net.iamkel.MHWebViewController;
488 | PRODUCT_NAME = "$(TARGET_NAME)";
489 | SWIFT_VERSION = 5.0;
490 | TARGETED_DEVICE_FAMILY = "1,2";
491 | };
492 | name = Debug;
493 | };
494 | A6C57915227DEAB400D720DD /* Release */ = {
495 | isa = XCBuildConfiguration;
496 | baseConfigurationReference = C43E0DAC2C1AABC7438C2419 /* Pods-Example.release.xcconfig */;
497 | buildSettings = {
498 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
499 | CODE_SIGN_STYLE = Automatic;
500 | DEVELOPMENT_TEAM = V542NQW43X;
501 | INFOPLIST_FILE = Example/Info.plist;
502 | IPHONEOS_DEPLOYMENT_TARGET = 9.0;
503 | LD_RUNPATH_SEARCH_PATHS = (
504 | "$(inherited)",
505 | "@executable_path/Frameworks",
506 | );
507 | PRODUCT_BUNDLE_IDENTIFIER = net.iamkel.MHWebViewController;
508 | PRODUCT_NAME = "$(TARGET_NAME)";
509 | SWIFT_VERSION = 5.0;
510 | TARGETED_DEVICE_FAMILY = "1,2";
511 | };
512 | name = Release;
513 | };
514 | A6C57917227DEAB400D720DD /* Debug */ = {
515 | isa = XCBuildConfiguration;
516 | baseConfigurationReference = 1F7D32E1CF6F21BA33588664 /* Pods-ExampleTests.debug.xcconfig */;
517 | buildSettings = {
518 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
519 | BUNDLE_LOADER = "$(TEST_HOST)";
520 | CODE_SIGN_STYLE = Automatic;
521 | DEVELOPMENT_TEAM = V542NQW43X;
522 | INFOPLIST_FILE = ExampleTests/Info.plist;
523 | LD_RUNPATH_SEARCH_PATHS = (
524 | "$(inherited)",
525 | "@executable_path/Frameworks",
526 | "@loader_path/Frameworks",
527 | );
528 | PRODUCT_BUNDLE_IDENTIFIER = net.iamkel.MHWebViewControllerTests;
529 | PRODUCT_NAME = "$(TARGET_NAME)";
530 | SWIFT_VERSION = 5.0;
531 | TARGETED_DEVICE_FAMILY = "1,2";
532 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example";
533 | };
534 | name = Debug;
535 | };
536 | A6C57918227DEAB400D720DD /* Release */ = {
537 | isa = XCBuildConfiguration;
538 | baseConfigurationReference = 568709FAC4B40356A6A6F4C0 /* Pods-ExampleTests.release.xcconfig */;
539 | buildSettings = {
540 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
541 | BUNDLE_LOADER = "$(TEST_HOST)";
542 | CODE_SIGN_STYLE = Automatic;
543 | DEVELOPMENT_TEAM = V542NQW43X;
544 | INFOPLIST_FILE = ExampleTests/Info.plist;
545 | LD_RUNPATH_SEARCH_PATHS = (
546 | "$(inherited)",
547 | "@executable_path/Frameworks",
548 | "@loader_path/Frameworks",
549 | );
550 | PRODUCT_BUNDLE_IDENTIFIER = net.iamkel.MHWebViewControllerTests;
551 | PRODUCT_NAME = "$(TARGET_NAME)";
552 | SWIFT_VERSION = 5.0;
553 | TARGETED_DEVICE_FAMILY = "1,2";
554 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Example.app/Example";
555 | };
556 | name = Release;
557 | };
558 | /* End XCBuildConfiguration section */
559 |
560 | /* Begin XCConfigurationList section */
561 | A6C578F1227DEAAF00D720DD /* Build configuration list for PBXProject "Example" */ = {
562 | isa = XCConfigurationList;
563 | buildConfigurations = (
564 | A6C57911227DEAB400D720DD /* Debug */,
565 | A6C57912227DEAB400D720DD /* Release */,
566 | );
567 | defaultConfigurationIsVisible = 0;
568 | defaultConfigurationName = Release;
569 | };
570 | A6C57913227DEAB400D720DD /* Build configuration list for PBXNativeTarget "Example" */ = {
571 | isa = XCConfigurationList;
572 | buildConfigurations = (
573 | A6C57914227DEAB400D720DD /* Debug */,
574 | A6C57915227DEAB400D720DD /* Release */,
575 | );
576 | defaultConfigurationIsVisible = 0;
577 | defaultConfigurationName = Release;
578 | };
579 | A6C57916227DEAB400D720DD /* Build configuration list for PBXNativeTarget "ExampleTests" */ = {
580 | isa = XCConfigurationList;
581 | buildConfigurations = (
582 | A6C57917227DEAB400D720DD /* Debug */,
583 | A6C57918227DEAB400D720DD /* Release */,
584 | );
585 | defaultConfigurationIsVisible = 0;
586 | defaultConfigurationName = Release;
587 | };
588 | /* End XCConfigurationList section */
589 | };
590 | rootObject = A6C578EE227DEAAF00D720DD /* Project object */;
591 | }
592 |
--------------------------------------------------------------------------------