{"id":21374038,"url":"https://github.com/itenfay/DYFProgressView","last_synced_at":"2025-07-13T08:32:11.285Z","repository":{"id":56908091,"uuid":"186655871","full_name":"itenfay/DYFProgressView","owner":"itenfay","description":"超好用的进度条和网页进度条，操作简单好用。(Super useful progress bar and web page progress bar, the operation is simple and easy to use.)","archived":false,"fork":false,"pushed_at":"2024-06-16T15:21:17.000Z","size":2331,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-19T03:04:43.784Z","etag":null,"topics":["ios","loading","loading-animations","objective-c","progress","progress-bar","progressbar","progressview","web-progress","widget"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/itenfay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-05-14T15:59:56.000Z","updated_at":"2024-06-16T15:20:25.000Z","dependencies_parsed_at":"2023-07-13T12:15:29.987Z","dependency_job_id":null,"html_url":"https://github.com/itenfay/DYFProgressView","commit_stats":null,"previous_names":["dgynfi/dyfprogressview","itenfay/dyfprogressview"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itenfay%2FDYFProgressView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itenfay%2FDYFProgressView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itenfay%2FDYFProgressView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itenfay%2FDYFProgressView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itenfay","download_url":"https://codeload.github.com/itenfay/DYFProgressView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225693834,"owners_count":17509227,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","loading","loading-animations","objective-c","progress","progress-bar","progressbar","progressview","web-progress","widget"],"created_at":"2024-11-22T08:29:39.044Z","updated_at":"2024-11-22T08:30:07.581Z","avatar_url":"https://github.com/itenfay.png","language":"Objective-C","readme":"\u003cdiv align=center\u003e\n\u003cimg src=\"https://github.com/itenfay/DYFProgressView/raw/master/images/DYFProgressView.png\" width=\"50%\"\u003e\n\u003c/div\u003e\n\n如果能帮助到你，请你给[一颗星](https://github.com/itenfay/DYFProgressView)，谢谢！(If this can help you, please give it a [star](https://github.com/itenfay/DYFProgressView). Thanks!)\n\n## DYFProgressView\n\n超好用的进度条和网页进度条，操作简单好用。(Super useful progress bar and web page progress bar, the operation is simple and easy to use.)\n\n[![License MIT](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](LICENSE)\u0026nbsp;\n[![CocoaPods](http://img.shields.io/cocoapods/v/DYFProgressView.svg?style=flat)](http://cocoapods.org/pods/DYFProgressView)\u0026nbsp;\n![CocoaPods](http://img.shields.io/cocoapods/p/DYFProgressView.svg?style=flat)\u0026nbsp;\n\n## Group (ID:614799921)\n\n\u003cdiv align=left\u003e\n\u0026emsp; \u003cimg src=\"https://github.com/itenfay/DYFProgressView/raw/master/images/g614799921.jpg\" width=\"30%\" /\u003e\n\u003c/div\u003e\n\n## Installation\n\nUsing [CocoaPods](https://cocoapods.org):\n\n```\npod 'DYFProgressView'\n```\n\nOr\n\n```\npod 'DYFProgressView', '~\u003e 1.2.1'\n```\n\n## Preview\n\n\u003cdiv align=left\u003e\n\u0026emsp; \u003cimg src=\"https://github.com/itenfay/DYFProgressView/raw/master/images/ProgressViewPreview.gif\" width=\"40%\" /\u003e\n\u003c/div\u003e\n\n## Usage\n\n1. 实例化\n\n```ObjC\n// Lazy load\n- (DYFWebProgressView *)progressView {\n    if (!_progressView) {\n        CGFloat w = self.navigationBar.bounds.size.width;\n        CGFloat h = 3.f;\n        CGFloat x = 0.f;\n        CGFloat y = self.navigationBar.bounds.size.height - h;\n\n        _progressView = [[DYFWebProgressView alloc] initWithFrame:CGRectMake(x, y, w, h)];\n        _progressView.lineWidth = 3.f;\n        _progressView.lineColor = [UIColor colorWithRed:RGB_V(10) \n                                                  green:RGB_V(115) \n                                                   blue:RGB_V(255) \n                                                  alpha:1];\n    }\n    return _progressView;\n}\n\n- (UINavigationBar *)navigationBar {\n    return self.navigationController.navigationBar;\n}\n```\n\n2. 添加到父视图\n\n```\n// 在开始加载进度前，调用它\n- (void)loadView {\n    [super loadView];\n    [self addProgressView];\n}\n\n// 添加到父视图。\n- (void)addProgressView {\n    if (!_progressView) {\n        [self.navigationBar addSubview:self.progressView];\n    }\n}\n```\n\n3. 开始加载进度\n\n```\n[self.progressView startLoading];\n```\n\n4. 结束加载进度\n\n```\n[self.progressView endLoading];\n```\n\n## How to embed the WKWebView ?\n\n1. Invoked when a main frame navigation starts.\n\n```\n- (void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation {\n    // didStartProvisionalNavigation.\n\n    NSURL *aURL = [webView.URL copy];\n    NSLog(@\"%s url: %@\", __FUNCTION__, aURL);\n\n    [self.progressView startLoading];\n}\n```\n\n2. Invoked when a server redirect is received for the main frame.\n\n```\n- (void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation {\n    // didReceiveServerRedirectForProvisionalNavigation.\n    NSLog(@\"%s url: %@\", __FUNCTION__, webView.URL);\n}\n```\n\n3. Invoked when content starts arriving for the main frame.\n\n```\n- (void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation {\n    NSLog(@\"%s\", __FUNCTION__);\n}\n```\n\n4. Invoked when a main frame navigation completes.\n\n```\n- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {\n    NSLog(@\"%s\", __FUNCTION__);\n    [self.progressView endLoading];\n    [self setupNavigationItemTitle];\n}\n```\n\n5. Invoked when an error occurs while starting to load data for the main frame.\n\n```\n- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error {\n    if (!error) { return; }\n\n    NSString *errMessage = [NSString stringWithFormat:@\"%zi, %@\", error.code, error.localizedDescription];\n    NSLog(@\"%s [error]: %@\", __FUNCTION__, errMessage);\n\n    [self.progressView endLoading];\n}\n```\n\n6. Invoked when an error occurs during a committed main frame navigation.\n\n```\n- (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error {\n    if (!error) { return; }\n\n    NSString *errMessage = [NSString stringWithFormat:@\"%zi, %@\", error.code, error.localizedDescription];\n    NSLog(@\"%s [error]: %@\", __FUNCTION__, errMessage);\n\n    [self.progressView endLoading];\n}\n```\n\n7. Decides whether to allow or cancel a navigation.\n\n```\n- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {\n    // decidePolicyForNavigationAction.\n    [self setupNavigationItemTitle];\n\n    NSURL *aURL = [navigationAction.request.URL copy];\n    NSString *aUrl = aURL.absoluteString;\n    NSLog(@\"%s url: %@\", __FUNCTION__, aUrl);\n\n    if (![aUrl isEqualToString:@\"about:blank\"]) {}\n\n    // Method NO.1: resolve the problem about '_blank'.\n    //if (navigationAction.targetFrame == nil) {\n        //NSLog(@\"- [webView loadRequest:navigationAction.request]\");\n        //[webView loadRequest:navigationAction.request];\n    //}\n\n    decisionHandler(WKNavigationActionPolicyAllow);\n}\n```\n\n8. Creates a new web view. Resolves the problem about '_blank'.\n\n```\n// Method NO.2: resolve the problem about '_blank'.\n- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures {\n    // createWebViewWithConfiguration.\n\n    NSURL *aURL = [navigationAction.request.URL copy];\n    NSString *aUrl = aURL.absoluteString;\n    NSLog(@\"%s url: %@\", __FUNCTION__, aUrl);\n\n    if (!navigationAction.targetFrame.isMainFrame) {\n        NSLog(@\"- [webView loadRequest:navigationAction.request]\");\n        [webView loadRequest:navigationAction.request];\n    }\n\n    return nil;\n}\n```\n\n9. The navigation item’s title displayed in the navigation bar.\n\n```\n- (void)setupNavigationItemTitle {\n    self.navigationItem.title = self.wk_webView.title;\n}\n```\n\n## Sample\n\n- [Code Sample Portal](https://github.com/itenfay/DYFProgressView/blob/master/Basic%20Files/DYFDisplayViewController.m)\n","funding_links":[],"categories":["OOM-Leaks-Crash"],"sub_categories":["WebView-ProgressBar"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitenfay%2FDYFProgressView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitenfay%2FDYFProgressView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitenfay%2FDYFProgressView/lists"}