Giter Club home page Giter Club logo

swiftwebvc's People

Contributors

alroman avatar antigp avatar azhararmar avatar bchrobot avatar igorkulman avatar jalakoo avatar lfarah avatar meismyles avatar mwilliams123 avatar ntnhon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swiftwebvc's Issues

Doesn't display local files properly

When trying to display a local file like this url: "file:///var/mobile/Containers/Data/Application/blahblahblah/downloads/15212173031370-A8AB82E7-A719-4148-89CE-D5CE9FD468C6.jpg" it doesn't display anything. This is related to an old WKWebView bug that has since been fixed back in iOS 9.
It requires that we load the url with
webView.loadFileURL(url, allowingReadAccessTo: url)
instead of
webView.load(request)

I've managed to find a spot to drop that in that works, but is a little ugly and probably doesn't match the organization of the existing code very well.

If you drop the following code in right here it fixes things.

func loadRequest(_ request: URLRequest) {
        if let url = request.url,
            url.absoluteString.contains("file:"),
            #available(iOS 9.0, *) {
                webView.loadFileURL(url, allowingReadAccessTo: url)
        } else {
            webView.load(request)
        }
}

Not compiling in XCode 9.2

When trying to compile the framework this error arrises:

SwiftWebVC/SwiftWebVC/SwiftWebVC.swift:133:75: Cannot assign value of type 'UIColor?' to type 'UIColor!'

Dismissing SwiftModalWebVC does not stop webview

For example, if you are playing audio in a modal web VC and dismiss it the audio continues playing.

I believe this is due to the doneButtonTapped method being handled by the child webViewController: SwiftWebVC

Image assets for buttons aren't loaded

Hi, I've tried adding SwiftWebVC to an empty project via CocoaPods but there is an issue with image assets in the bundle. It looks like once the pod is installed, image assets are not a part of the bundle anymore (although if you look on the filesystem, they are). The result is that the images aren't loaded when the browser view is displayed. Attached screenshot shows the issue.

If you need more information, please let me know.

swiftwebvc-issue

Using this library from Objc?

Hello and thank you for this library! I have a project with both Swift and legacy Objective C ViewControllers and I am trying to use this library from my objc classes but I cannot call the initializers.

From swift it works fine and its great. :) Any plans on adding obj c support? (Since this library uses the WKWebView while the objc library this is based on uses the deprecated UIWebView)

Inject JavaScript

Hi thanks for the great code! I am trying to find a way to inject JavaScript to the embedded WebView. Could anyone shed some lights here? Thanks!

Crash on iOS11

On iOS11 showing the browser crashes in SwiftWebVC.swift in method updateToolbarItems() on

let refreshStopBarButtonItem: UIBarButtonItem = webView.isLoading ? stopBarButtonItem : refreshBarButtonItem

with Thread 1: EXC_BAD_ACCESS (code=2, address=0x604000286f90) when the browser is first opened.

High Memory Usage

I've been on/off with SwiftWebVC because it used up A LOT of storage. Haven't specifically found anything yet, so decided to post this issue up.

Alter the HTML loaded in SwiftWebVC?

Is there any way to insert myself into the html loading process? I'd like to apply a few simple text replacements with the html, but the delegate only gives me start and finish call backs.

Is the only way to wait until it has been loaded and then pull the HTML from the webview, change it, and then set it? If so, will that trigger the didFinishLoading() callback again?

@3x Images are missing.

Also, you don't need to create Ipad specific images. You can check iPhone and iPad from attributes inspector

Crash in iOS 11

crash log:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Completion handler passed to -[SwiftWebVC.SwiftWebVC webView:decidePolicyForNavigationAction:decisionHandler:] was called more than once'
*** First throw call stack:
(0x18606c4e8 0x1a89dc528 0x18606c430 0x18e3538c0 0x18e3996f4 0x1095fc0f0 0x1095fbf1c 0x1095fc0b0 0x18e397258 0x18e4f9fcc 0x18e522c78 0x18e51c32c 0x18e394bdc 0x18e56ee50 0x18e356440 0x18e353db8 0x18e356670 0x18942c178 0x18942c438 0x1860131a0 0x1860129d4 0x18601057c 0x185f2b03c 0x19679ef94 0x18cef086c 0x1042d4030 0x1a974bd1c)
libc++abi.dylib: terminating with uncaught exception of type NSException

iOS 8 support

I have tried running in Simulator iOS 8.1 and everything is working well except #22

I think you could change deployment target to 8 in the podspec

Can I use this Pod in swift 4.2 or later versions?

I have installed this pod for swift 4.2.
It causes some errors while compiling. So I unlocked the Podfiles and fixed it for swift4.2.
But, the problem is, the 'Done' Button isn't appear.
I found this pod for that point. To back my app.
Can you explain more about it or provide any updated versions of this Pod?

Crash while navigating in and then back out again quickly

When pushing SwiftWebVC on the navigation controller and pressing back again before loading, it can cause SwiftWebVC to crash due to forced unwrapped optionals.

Solution:
from line 197 in SwiftWebVC.swift
replace

            if !closing {
                if presentingViewController == nil {
                    navigationController!.toolbar.barTintColor = navigationController!.navigationBar.barTintColor
                }
                else {
                    navigationController!.toolbar.barStyle = navigationController!.navigationBar.barStyle
                }
                navigationController!.toolbar.tintColor = navigationController!.navigationBar.tintColor
                toolbarItems = items as? [UIBarButtonItem]
            }

with

            if let navigationController = navigationController, !closing {
                if presentingViewController == nil {
                    navigationController.toolbar.barTintColor = navigationController.navigationBar.barTintColor
                }
                else {
                    navigationController.toolbar.barStyle = navigationController.navigationBar.barStyle
                }
                navigationController.toolbar.tintColor = navigationController.navigationBar.tintColor
                toolbarItems = items as? [UIBarButtonItem]
            }

handle js

in SwiftWebVC.swift, i have added config as follw

public class SwiftWebVC: UIViewController,WKScriptMessageHandler {
public var jsHandler:((WKScriptMessage)->())?
...
}
lazy var webView: WKWebView = {
        let configuration = WKWebViewConfiguration()
        configuration.userContentController.add(self, name: "wawa")
        var tempWebView = WKWebView(frame: UIScreen.main.bounds, configuration: configuration)
        tempWebView.uiDelegate = self
        tempWebView.navigationDelegate = self
        return tempWebView;
    }()
public func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) {
        if self.jsHandler != nil {
            self.jsHandler!(message)
        }
    }

and it just fail to work, maybe i need help.

SwiftWebVC never loads some urls, Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service

Trying SwiftWebVC out for the first time and I'm having a problem loading certain pages. This is how I show it:

let webVC = SwiftWebVC(urlString: "http://www.udwa.org/our-union/")
webVC.delegate = self
self.navigationController?.pushViewController(webVC, animated: true)

The delegate call back tells me that it started loading, after 30 seconds I get the following in the console:

2017-10-14 11:57:05.941522-0700 udw[61741:29492827] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
2017-10-14 11:57:05.942308-0700 udw[61741:29492827] Could not signal service com.apple.WebKit.Networking: 113: Could not find specified service

I tried several other URLs:

  1. https://www.google.com/ : worked, doesn't print the WebContent error above
  2. https://github.com/meismyles/SwiftWebVC : worked, doesn't print the WebContent error above
  3. http://www.inadaydevelopment.com : failed. This is my company's website, a WP site hosted in Google's cloud.
  4. http://herdboss.com/ : failed. This is another company I'm part of, a drupal site hosted at Rackspace.
  5. http://garyjohnston.com/ : failed. A friend's website, a WP site. Not sure where it's hosted, but it's a different server from 3 and 4 above.

I get the same behavior when using the SwiftModalWebVC.

Any help is appreciated.

screen shot 2017-10-14 at 11 48 30 am

Crash while using inside UIPagerViewController

When using your module inside UIPagerViewController app will crash. It happening because deinit method accessing lazy var that not initialized yet. So lazy var perform init and try to set deallocating object as delegate to WKWebView.
UIPagerViewController requires two VC (in case when pager view displays only one VC at time), one of them will be unused and deallocated before loadView() was called.

Add some delegate methods

Like didStartLoading, didFinishLoading, didFailLoading

This way we can show a progress while loading

Navigation Bar Items Wrong Position on First Load

I'm having an issue in iOS 11 where when you first open the view controller the back, forward, refresh and share buttons are all in the wrong place.

1

They should be in the following position even before the page loads.

2

Title not centered

Seems like the title of subpages is not always centered. If I open the viewController as follows and navigate back and forth in the pages, sometimes the title is aligned left, instead of center (see screenshot below: Kontakte title in bar on top).

UINavigationController(rootViewController: SwiftWebVC(urlString: "https://mandelkind.help/valletti"))

simulator screen shot 26 06 2017 21 12 53

Xcode doesn't recognise the SwiftWebVC class

Whenever I try to instantiate the SwiftWebVC or any other class I get a compiler error that it isn't recognized.
Even tough the assets are recognized.

Am I missing something, is this a known issue because this currently renders the the whole framework unusable for me.

screen shot 2018-06-21 at 12 43 35

Force-unwrapping URL leads to crash, if the url string is invalid.

public convenience init(urlString: String) {
        var urlString = urlString
        if !urlString.hasPrefix("https://") && !urlString.hasPrefix("http://") {
            urlString = "https://"+urlString
        }
        self.init(pageURL: URL(string: urlString)!)
 }

when urlString is invalid, URL(string: urlString) is nil - that leads to crash.

Done button not appearing

I am using below code,

let webVC = SwiftWebVC(urlString: "http://google.com")
self.navigationController?.pushViewController(webVC, animated: true)

But I don't see Done button on top.

This is the most important part of this lib and its missing.

** You have this functionality in Modal.

Dismiss button on `SwiftModalWebVC`

Hey @meismyles

I've noticed that the modal version of the browser uses a V icon for dismissing the modal view instead of the more traditional and well-established X.

Is this something that you could change or at least make configurable?

Blank screen with activity indicator issue for certain URL strings cases

Version: 0.4.0

I noticed there are two cases where your module gets stuck on a blank screen with a spinning Activity Indicator (see screenshot):

simulator screen shot jun 12 2017 5 15 43 pm

  1. No schema
let webVC = SwiftModalWebVC(urlString: "www.google.com")
  1. HTTP schema (not HTTPS)
let webVC = SwiftModalWebVC(urlString: "http://www.google.com")

I'm able to make this work if you create an iOS 8+ ATS exception for each HTTP domain or if you set NSAllowsArbitraryLoads.

	<key>NSAppTransportSecurity</key>
	<dict>
		<key>NSAllowsArbitraryLoads</key>
		<true/>
	</dict>

My question is: is there any way to allow HTTP links on WKWebView without doing the above?

Thanks!

Swift 4

Hi, are you considering update it to support swift 4?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.