{"id":13338681,"url":"https://github.com/Chandlerdea/UIKitHelpers","last_synced_at":"2025-03-11T10:31:44.013Z","repository":{"id":145470965,"uuid":"101342547","full_name":"Chandlerdea/UIKitHelpers","owner":"Chandlerdea","description":"UIKit additions that make my life easier","archived":false,"fork":false,"pushed_at":"2020-07-08T02:48:24.000Z","size":38,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-23T22:18:08.076Z","etag":null,"topics":["cocoa","cocoa-touch","ios","macos","nslayoutconstraint","swift4","tvos","uikit","uiview","watchos"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Chandlerdea.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-24T22:26:07.000Z","updated_at":"2020-07-08T02:48:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"12db37ef-1cff-498f-8da0-f14a9b221ac6","html_url":"https://github.com/Chandlerdea/UIKitHelpers","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chandlerdea%2FUIKitHelpers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chandlerdea%2FUIKitHelpers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chandlerdea%2FUIKitHelpers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chandlerdea%2FUIKitHelpers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Chandlerdea","download_url":"https://codeload.github.com/Chandlerdea/UIKitHelpers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243015423,"owners_count":20222080,"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":["cocoa","cocoa-touch","ios","macos","nslayoutconstraint","swift4","tvos","uikit","uiview","watchos"],"created_at":"2024-07-29T19:17:08.446Z","updated_at":"2025-03-11T10:31:43.993Z","avatar_url":"https://github.com/Chandlerdea.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UIKitHelpers\n\nThis framework is just an extension on UIView that makes my day easier. \n\n## Requirements\n\nThis is written in Swift 4, works with macOS, iOS, watchOS, and tvOS.\n\n## Installation\n\nYou can install this library with Carthage, or Swift's package manager\n\n### Carthage\n\nAdd this line to you `Cartfile`:\n\n    github \"Chandlerdea/UIKitHelpers\"\n    \nRun `carthage update` and then add the created framework in `$(SRCROOT)/Carthage/build/iOS` to the Embedded Binaries section of you project.\n\n### Cocopods\n\nI'm having trouble linting the cocoapod, so cocoapods support isn't available just yet. I'll be adding it as soon as I figure out the issue.\n\n### Swift Package Manager\n\nIn your Packages.swift file, add this code\n\n    import PackageDescription\n\n    let package = Package(\n        url: \"https://github.com/Chandlerdea/UIKitHelpers/UIKitHelpers.swift\"\n        majorVersion: 1\n    )\n    \n\n## How to use\n\nThere is also a protocol `ReusableViewType` which looks like this:\n\n    public protocol ReusableViewType {\n        static var reuseIdentifier: String { get }\n    }\n    extension ReusableViewType where Self: NSObject {\n\t    static public var reuseIdentifier: String {\n\t        let classString = NSStringFromClass(self)\n\t        if classString.contains(\".\") {\n\t            return classString.components(separatedBy: \".\")[1]\n\t        } else {\n\t            return classString\n\t        }\n\t    }\n\t}\n\n`UITableViewCell`, `UICollectionViewCell`, `UITableViewHeaderFooterView`, and `UICollectionReusableView` all conform to this protocol. I mostly use this with registering cells, so I can register cells with string representations of their name, like this:\n\n    tableView.register(SomeCell.self, forCellReuseIdentifier: SomeCell.reuseIdentifier)\n\n\nThe extension on `UIView` has some convenient methods for common `UIKit` usecases. For example:\n* The ability to create constraints with a priority, without having to create and modify the constraint, in a familiar API that looks like the existing auto layout api. Here are a few examples: \n  * `constraint(equalTo anchor: NSLayoutDimension, constant: CGFloat, priority: CGFloat) -\u003e NSLayoutConstraint`\n  * `constraint(equalTo anchor: NSLayoutXAxisAnchor, constant: CGFloat, priority: CGFloat) -\u003e NSLayoutConstraint`\n  * `constraint(equalTo anchor: NSLayoutYAxisAnchor, constant: CGFloat, priority: CGFloat) -\u003e NSLayoutConstraint`\n* An easy, type safe way to load a class from a nib with `class func loadFromNib\u003cT: UIView\u003e() -\u003e T`\n* An easy way to pin a view to all sides of its superview, with optional padding and priorities for the constraints: `activateAllSideAnchors(relativeToMargins: Bool! = false, padding: UIEdgeInsets! = nil, priorities: UIEdgeInsets! = nil)`\n\nThere are a few others for small things like finding subviews, andding more than one subview at once, and other stuff. They are small solutions to ways I have found Apple's APIs to be slightly lacking, or things that I have found myself having to do a lot across projects. If you have any critiques or enhancements you think could make this better, please open a PR. I would love to what others have come up with!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FChandlerdea%2FUIKitHelpers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FChandlerdea%2FUIKitHelpers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FChandlerdea%2FUIKitHelpers/lists"}