{"id":21802880,"url":"https://github.com/coderzhuxh/xhtoastswift","last_synced_at":"2025-08-25T07:33:57.126Z","repository":{"id":56928038,"uuid":"65603868","full_name":"CoderZhuXH/XHToastSwift","owner":"CoderZhuXH","description":"Swift简洁轻便提示工具,一行代码既可完成提示信息显示  - 支持自定义显示位置及停留时间.","archived":false,"fork":false,"pushed_at":"2017-10-26T01:05:37.000Z","size":335,"stargazers_count":128,"open_issues_count":1,"forks_count":49,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-21T20:37:03.485Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CoderZhuXH.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}},"created_at":"2016-08-13T06:54:03.000Z","updated_at":"2024-12-19T09:01:45.000Z","dependencies_parsed_at":"2022-08-21T06:20:28.107Z","dependency_job_id":null,"html_url":"https://github.com/CoderZhuXH/XHToastSwift","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/CoderZhuXH/XHToastSwift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoderZhuXH%2FXHToastSwift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoderZhuXH%2FXHToastSwift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoderZhuXH%2FXHToastSwift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoderZhuXH%2FXHToastSwift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CoderZhuXH","download_url":"https://codeload.github.com/CoderZhuXH/XHToastSwift/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoderZhuXH%2FXHToastSwift/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272024638,"owners_count":24860528,"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","status":"online","status_checked_at":"2025-08-25T02:00:12.092Z","response_time":1107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-11-27T11:34:00.398Z","updated_at":"2025-08-25T07:33:57.066Z","avatar_url":"https://github.com/CoderZhuXH.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# XHToastSwift\n#### 简洁轻便提示工具,一行代码,既可完成提示信息显示.\n\n[![AppVeyor](https://img.shields.io/appveyor/ci/gruntjs/grunt.svg?maxAge=2592000)](https://github.com/CoderZhuXH/XHToastSwift)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/CoderZhuXH/XHToastSwift)\n[![Version Status](https://img.shields.io/cocoapods/v/XHToastSwift.svg?style=flat)](http://cocoadocs.org/docsets/XHToastSwift)\n![Support](https://img.shields.io/badge/support-iOS%209%2B-brightgreen.svg)\n[![Pod Platform](https://img.shields.io/cocoapods/p/XHToastSwift.svg?style=flat)](http://cocoadocs.org/docsets/XHToastSwift)\n[![Pod License](https://img.shields.io/cocoapods/l/XHToastSwift.svg?style=flat)](https://github.com/CoderZhuXH/XHToastSwift/blob/master/LICENSE)\n\n==============\n\n#### OC版本请戳这里\u003e\u003e\u003e https://github.com/CoderZhuXH/XHToast\n### 技术交流群(群号:537476189)\n\n## 效果\n![image](https://github.com/CoderZhuXH/XHToastSwift/blob/master/DEMO.gif)\n\n## 使用方法\n#### 1.普通调用\n```swift\n    /*\n    您只需要调用一行代码,既可完成提示信息显示\n    */\n   \n   //1.在window上显示toast\n \n    /*\n    中间显示\n    */\n    XHToast.showCenterWithText(\"您要显示的提示信息\")\n\n    /*\n    上方显示\n    */\n    XHToast.showTopWithText(\"您要显示的提示信息\")\n\n    /*\n    下方显示\n    */\n    XHToast.showBottomWithText(\"您要显示的提示信息\")\n\n\n    //2.你也可以这样调用,在view上显示toast\n    /*\n    中间显示\n    */\n     self.view.showXHToastCenterWithText(\"您要显示的提示信息\")\n\n    /*\n    上方显示\n    */\n    self.view.showXHToastTopWithText(\"您要显示的提示信息\")\n\n    /**\n    * 底端显示\n    */\n    self.view.showXHToastBottomWithText(\"您要显示的提示信息\")\n\n```\n#### 2.自定义Toast停留时间+到屏幕上端/下端距离(见如下方法)\n##### 1.显示至window\n```swift\n\n    // MARK:-中间显示\n\n    /**\n     中间显示+自定义时间\n     \n     - parameter text:     文字\n     - parameter duration: 自定义停留时间\n     */\n    public class func showCenterWithText(_ text:String, duration:CGFloat)\n\n    // MARK:-上方显示\n\n    /**\n     上方显示+自定义停留时间\n     \n     - parameter text:     文字\n     - parameter duration: 自定义停留时间\n     */\n    public class func showTopWithText(_ text:String, duration:CGFloat)\n\n    /**\n     上方显示+自定义到顶部距离\n     \n     - parameter text:      文字\n     - parameter topOffset: 自定义到顶部距离\n     */\n    public class func showTopWithText(_ text:String,topOffset:CGFloat)\n\n    /**\n     上方显示+自定义到顶部距离+自定义停留时间\n     \n     - parameter text:      文字\n     - parameter topOffset: 自定义到顶部距离\n     - parameter duration:  自定义停留时间\n     */\n    public class func showTopWithText(_ text:String, topOffset:CGFloat,duration:CGFloat)\n\n    // MARK:-下方显示\n\n    /**\n     下方显示+自定义停留时间\n     \n     - parameter text:     文字\n     - parameter duration: 自定义停留时间\n     */\n    public class func showBottomWithText(_ text:String,duration:CGFloat)\n\n    /**\n     下方显示+自定义到底部距离\n     \n     - parameter text:         文字\n     - parameter bottomOffset: 自定义到底部距离\n     */\n    public class func showBottomWithText(_ text:String,bottomOffset:CGFloat)\n\n    /**\n     下方显示+自定义到底部距离+自定义停留时间\n     \n     - parameter text:         文字\n     - parameter bottomOffset: 自定义到底部距离\n     - parameter duration:     自定义停留时间\n     */\n    public class func showBottomWithText(_ text:String,bottomOffset:CGFloat,duration:CGFloat)\n\n```\n##### 2.显示至view\n\n```swift\n\n // MARK:- 中间显示\n    \n\n    /// 中间显示+自定义停留时间\n    ///\n    /// - Parameters:\n    ///   - text: 文字\n    ///   - duration: 自定义停留时间\n    public func showXHToastCenterWithText(_ text:String , duration:CGFloat)\n\n    \n    /// 上方显示+自定义停留时间\n    ///\n    /// - Parameters:\n    ///   - text: 文字\n    ///   - duration: 自定义停留时间\n    public func showXHToastTopWithText(_ text:String,  duration:CGFloat)\n\n    \n  // MARK:- 上方显示 \n\n    /// 上方显示+自定义到顶部距离\n    ///\n    /// - Parameters:\n    ///   - text: 文字\n    ///   - topOffset: 自定义到顶部距离\n    public func showXHToastTopWithText(_ text:String,topOffset:CGFloat)\n    \n    \n    /// 上方显示+自定义到顶部距离+自定义停留时间\n    ///\n    /// - Parameters:\n    ///   - text: 文字\n    ///   - topOffset: 自定义到顶部距离\n    ///   - duration: 自定义停留时间\n    public  func showXHToastTopWithText(_ text:String,topOffset:CGFloat,duration:CGFloat) \n    \n\n  // MARK:- 下方显示    \n\n    /// 下方显示+自定义停留时间\n    ///\n    /// - Parameters:\n    ///   - text: 文字\n    ///   - duration: 自定义停留时间\n    public func showXHToastBottomWithText(_ text:String,  duration:CGFloat)\n\n    \n    /// 下方显示+自定义到顶部距离\n    ///\n    /// - Parameters:\n    ///   - text: 文字\n    ///   - topOffset: 自定义到顶部距离\n    public func showXHToastBottomWithText(_ text:String,bottomOffset:CGFloat)\n\n    \n    /// 下方显示+自定义到顶部距离+自定义停留时间\n    ///\n    /// - Parameters:\n    ///   - text: 文字\n    ///   - topOffset: 自定义到顶部距离\n    ///   - duration: 自定义停留时间\n    public  func showXHToastBottomWithText(_ text:String,bottomOffset:CGFloat,duration:CGFloat)\n\n\n```\n##  安装\n### 1.手动添加:\u003cbr\u003e\n*   1.将 XHToastSwift文件夹添加到工程目录中即可\u003cbr\u003e\n\n### 2.CocoaPods:\u003cbr\u003e\n*   1.在 Podfile 中添加 pod 'XHToastSwift'\u003cbr\u003e\n*   2.执行 pod install 或 pod update\u003cbr\u003e\n*   3.导入 import XHToastSwift\n\n### 3.Tips\n*   1.如果发现pod search XHToastSwift 搜索出来的不是最新版本，需要在终端执行cd desktop退回到desktop，然后执行pod setup命令更新本地spec缓存（需要几分钟），然后再搜索就可以了\n*   2.如果你发现你执行pod install后,导入的不是最新版本,请删除Podfile.lock文件,在执行一次 pod install\n\n##  系统要求\n*   该项目最低支持 iOS 8.0 和 Xcode 8\n\n##  许可证\nXHToast 使用 MIT 许可证，详情见 LICENSE 文件","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderzhuxh%2Fxhtoastswift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderzhuxh%2Fxhtoastswift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderzhuxh%2Fxhtoastswift/lists"}