Useful Swift code samples, extensions, functionalities and scripts to cherry-pick and use in your projects

Related tags

Utility SwiftyPick
Overview

SwiftyPick πŸ¦… πŸ’

Documentation

Useful Swift code samples, extensions, functionalities and scripts to cherry-pick and use in your projects.

Purpose

The idea behind this project is not to be a pod that users import into their own projects, but rather a collection of useful ideas, well-organized and documented, to cherry-pick as needed into another projects. Every new piece of functionality will have a proper document explaining it's usage under the Documentation directory.

Installation

SwiftLint

brew install swiftlint

Configure the Git Hooks

git config core.hooksPath .githooks

CocoaPods

Run pod install on the root of the project

Open SwiftyPick.xcworkspace with Xcode

Features πŸš€

Code

Extensions

Features

  • SwiftGen: Get autogenerated instances of colors, images, and localized strings.

Networking

  • // TODO //

Testing

  • Xcode Test Plans: Configure different test plans in your project in order to test different configurations.

UI

  • // TODO //

Process

Danger

  • Danger: Configure Danger and add a Github Action to run the script on every PR.

Documentation

  • Jazzy: Configure Jazzy to get autogenerated html files for documentation.

Fastlane

  • Fastlane: Configure Fastlane in your project and add a Github Action to run the tests on every PR to main.
  • Run Test Plans on Fastlane: Configure your fastfile to run different test plans.

Github

SwiftLint

  • SwiftLint: How to add and configure SwiftLint rules.

Scripts

TODOs

This is the list of things I want to add to the project in the near future:

  • Logger: Object to log useful information to the console (and to report to analytics/crashlytics)
  • NumberFormatter + Regional unit tests (ie: check the , or . separator for decimals/thousands depending on the region)
  • CurrencyFormatter + Regional unit tests
  • DateFormatter + Regional unit tests
  • Lightweight URLSession networking layer
  • Dynamic Fonts (For accessibility)
  • UITests layer using Page Object pattern
  • Schemes (prod/dev)
  • UserDefaults easy access / FeatureFlags using UserDefaults
  • UIView extension with some basic animations
  • UITableViewCell/UICollectionViewCell extension for register, dequeue, and cellReuseIdentifier
  • Firebase integration (Analytics/Crashlytics/AB Testing/Flags)
  • Custom Operators from the Advanced Swift book
  • GraphQL support
  • A tableview in the home, where each cell will be the entry point to each feature (ie: color palettes, networking call via http, networking via graphQL, UI components, animations, formatters, etc)
  • Settings view: dark mode, color palette, app icon, local feature flags, display backend calls for debug, change accessibility features, etc

Contributing

Check out the Contribution guide

Comments
  • Run UI tests on GHA and report to Slack

    Run UI tests on GHA and report to Slack

    πŸ‘‹ Intro

    Run UI tests on GHA using Fastlane and report to Slack if there are errors

    πŸ€” What changed?

    • Change Fastlane workflow to also run UI tests
    • Grab configuration variables and use them to report errors to Slack
    • Remove Package configuration and Danger from the project

    βœ… Checklist

    • [X] Documentation on how to cherry-pick to another project updated in Documentation/GithubActions.md
    • [X] README updated
    tests 
    opened by mdb1 1
  • Update links in Readme to work well in Github Pages

    Update links in Readme to work well in Github Pages

    πŸ‘‹ Intro

    In order to get the correct behavior from the links in the hosted documentation of Github Pages, we need to use the full URL of the docs instead of the relative path

    πŸ€” What changed?

    • Just changed the documentation links in the Readme to use the full URL
    bug documentation 
    opened by mdb1 1
  • Move documentation to CI

    Move documentation to CI

    πŸ‘‹ Intro

    Move the documentation generation to Github Actions and host the docs using Github Pages

    πŸ€” What changed?

    • Removed all Jazzy docs from source control
    • Added Github Action to update the docs (hosted on Github Paged) on every push to main

    βœ… Checklist

    • [X] Documentation on how to cherry-pick to another project added in Documentation/Jazzy.md
    • [X] README updated
    documentation feature 
    opened by mdb1 1
  • Add TableView and TableViewCell helper methods

    Add TableView and TableViewCell helper methods

    πŸ‘‹ Intro

    Add a couple of helper methods to make life easier when working with table views and table view cells

    πŸ€” What changed?

    • πŸš€ Added methods for registering and dequeuing cells using generics
    • πŸš€ Added a static reuseIdentifier computed property to UITableViewCell
    • πŸ§ͺ Added test coverage for the new additions
    • 🎨 Refactored the current code to use the new additions

    πŸ’ How to cherry-pick to another project

    Check the Documentation/TableViewExtensions.md file

    βœ… Checklist

    • [X] Documentation on how to cherry-pick to another project added in Documentation/
    • [X] README updated
    • [X] Tests added for the new additions
    feature tests 
    opened by mdb1 1
  • Set minimum documentation level to internal

    Set minimum documentation level to internal

    πŸ‘‹ Intro

    Add swiftlint warning when something internal is not documented, in order to keep a high percentage of the codebase documented

    πŸ€” What changed?

    • Configured missing_docs rule to display warnings for internal things and errors for open and public
    • Changed generate_docs script to use internal as minimum documentation level in jazzy
    • Added missing documentation in the codebase
    • Ran generate_docs script
    documentation 
    opened by mdb1 1
  • MVP - UI Design Pattern

    MVP - UI Design Pattern

    πŸ‘‹ Intro

    Add the basics for having the MVP design pattern in the app

    πŸ€” What changed?

    • 🎨 Added initial MVP skeleton
    • Added BaseViewController, MainViewController, and FeaturesViewController
    • Added their views and presenters
    • Renamed ViewController to ColorPaletteViewController and adapt it to MVP
    • πŸ§ͺ Added unit tests for the new additions
    • βœ‚οΈ Remove the post-build script due to problems with Xcode generating test reports
    • πŸ› Minor change in hexString() method for UIColor
    • πŸ§ͺ Added a playground with the sample code from the docs

    πŸ’ How to cherry-pick to another project

    Read the docs on Documentation/MVP.md

    βœ… Checklist

    • [X] Documentation on how to cherry-pick to another project added in Documentation/MVP.md
    • [X] README updated
    • [X] Tests added for the new additions

    πŸ“± Screenshots

    | Features List | ColorPalette | |-|-| |||

    enhancement 
    opened by mdb1 1
  • Add Jazzy documentation

    Add Jazzy documentation

    πŸ‘‹ Intro

    Add Jazzy script to auto-generate html documentation for the project

    πŸ€” What changed?

    • Added missing docs for Spacing enum cases
    • Added script to run jazzy
    • Ran jazzy script to auto-generate the documentation html files

    πŸ’ How to cherry-pick to another project

    • Check Documentation/Jazzy.md file

    βœ… Checklist

    • [X] Documentation on how to cherry-pick to another project added in Documentation/
    • [X] README updated
    documentation 
    opened by mdb1 1
  • Enable more SwiftLint Rules

    Enable more SwiftLint Rules

    πŸ‘‹ Intro

    Add more SwiftLint rules to the project

    πŸ€” What changed?

    • Enabled the following rules:
    - attributes
    - duplicate_imports
    - missing_docs
    - single_test_class
    - sorted_imports
    - test_case_accessibility
    - vertical_parameter_alignment_on_call
    - vertical_whitespace_closing_braces
    - vertical_whitespace_opening_braces
    - xct_specific_matcher
    
    • Fix the new warnings
    • Removed redundant 'inthibit_warnings' from SwiftGet pod

    βœ… Checklist

    • [X] Documentation on how to cherry-pick to another project updated in Documentation/
    enhancement 
    opened by mdb1 1
  • πŸ› Move all colors to use Display-P3 color-space

    πŸ› Move all colors to use Display-P3 color-space

    πŸ‘‹ Intro

    The method to retrieve the hexadecimal of the colors was failing to retrieve the correct hexa for Apple's semantic colors, so this PR moves all the colors to use Display P3 as their color-space

    πŸ€” What changed?

    • Fixed bugs with hexadecimals
    • Fixed the tests
    • Added consistency by always using the same color-space
    bug 
    opened by mdb1 1
  • AutoLayout helper methods

    AutoLayout helper methods

    πŸ‘‹ Intro

    Add a couple of lightweight classes with helper methods for programmatic AutoLayout

    πŸ€” What changed?

    • Added convenience methods to add constrained views
    • Added convenience methods to pin views using constraints
    • Moved Spacing out of Constants to an enum
    • Use the new methods for everything UI related in the project
    • Added unit tests

    Example

    Before

    stackView.translatesAutoresizingMaskIntoConstraints = false
    addSubview(stackView)
    NSLayoutConstraint.activate([
        stackView.topAnchor.constraint(equalTo: topAnchor),
        stackView.leadingAnchor.constraint(equalTo: leadingAnchor),
        stackView.trailingAnchor.constraint(equalTo: trailingAnchor),
        stackView.bottomAnchor.constraint(equalTo: bottomAnchor)
    ])
    

    After

    addSubview(stackView, insets: .none)
    

    Using different spacings / relationships

    addSubview(
        hexaLabel,
        constrainedBy: [
            .top: .medium,
            .bottom: .medium,
            .trailing: .medium
        ]
    )
    hexaLabel.pin(
        .leading,
        to: .trailing,
        of: nameLabel,
        relatedBy: .greaterThanOrEqual,
        constant: Spacing.large.rawValue
    )
    

    πŸ’ How to cherry-pick to another project

    Check the docs on Documentation/AutoLayout.md

    βœ… Checklist

    • [x] Documentation on how to cherry-pick to another project added in Documentation/
    • [x] README updated
    • [X] Tests added for the new additions

    πŸ“± Screenshots

    | iPhone 11 | iPod | |-|-| |||

    Coverage

    Screen Shot 2021-08-31 at 19 38 07 Screen Shot 2021-08-31 at 19 38 15

    feature tests 
    opened by mdb1 1
  • πŸƒβ€β™€οΈClean up the fastlane code

    πŸƒβ€β™€οΈClean up the fastlane code

    πŸ‘‹ Intro

    The current fastlane code to run on github actions have a couple of hacks to bring up the simulator early. This should no longer be needed.

    πŸ€” What changed?

    • Deleted the hacks to bring up the simulator that are no longer needed
    • Cleaned up the lanes to run the regional tests
    • Updated the documentation

    βœ… Checklist

    • [X] Documentation on how to cherry-pick to another project added in Documentation/
    • [X] README updated
    enhancement 
    opened by mdb1 1
  • Bump jmespath from 1.4.0 to 1.6.1

    Bump jmespath from 1.4.0 to 1.6.1

    Bumps jmespath from 1.4.0 to 1.6.1.

    Release notes

    Sourced from jmespath's releases.

    Release v1.6.1 - 2022-03-07

    • Issue - Use JSON.parse instead of JSON.load.

    Release v1.6.0 - 2022-02-14

    • Feature - Add support for string comparissons.

    Release v1.5.0 - 2022-01-10

    • Support implicitly convertible objects/duck-type values responding to to_hash and to_ary.

      [See related GitHub pull request #51](jmespath/jmespath.rb#51).

    Changelog

    Sourced from jmespath's changelog.

    1.6.1 (2022-03-07)

    • Issue - Use JSON.parse instead of JSON.load.

    1.6.0 (2022-02-14)

    • Feature - Add support for string comparisons.

    1.5.0 (2022-01-10)

    • Support implicitly convertible objects/duck-type values responding to to_hash and to_ary.

      [See related GitHub pull request #51](jmespath/jmespath.rb#51).

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump cocoapods-downloader from 1.5.1 to 1.6.3

    Bump cocoapods-downloader from 1.5.1 to 1.6.3

    Bumps cocoapods-downloader from 1.5.1 to 1.6.3.

    Release notes

    Sourced from cocoapods-downloader's releases.

    1.6.3

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.2

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.1

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.0

    Enhancements
    • None.
    Bug Fixes
    • Adds a check for command injections in the input for hg and git.
      orta #124
    Changelog

    Sourced from cocoapods-downloader's changelog.

    1.6.3 (2022-04-01)

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.2 (2022-03-28)

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.1 (2022-03-23)

    Enhancements
    • None.
    Bug Fixes
    • None.

    1.6.0 (2022-03-22)

    Enhancements
    • None.
    Bug Fixes
    • Adds a check for command injections in the input for hg and git.
      orta #124
    Commits
    • c03e2ed Release 1.6.3
    • f75bccc Disable Bazaar tests due to macOS 12.3 not including python2
    • 52a0d54 Merge pull request #128 from CocoaPods/validate_before_dl
    • d27c983 Ensure that the git pre-processor doesn't accidentally bail also
    • 3adfe1f [CHANGELOG] Add empty Master section
    • 591167a Release 1.6.2
    • d2564c3 Merge pull request #127 from CocoaPods/validate_before_dl
    • 99fec61 Switches where we check for invalid input, to move it inside the download fun...
    • 96679f2 [CHANGELOG] Add empty Master section
    • 3a7c54b Release 1.6.1
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
Owner
Manu Herrera
iOS Tech Lead @blockfi. Former @muun, @mercadopago, @mercadolibre
Manu Herrera
SharkUtils is a collection of Swift extensions, handy methods and syntactical sugar that we use within our iOS projects at Gymshark.

SharkUtils is a collection of Swift extensions, handy methods and syntactical sugar that we use within our iOS projects at Gymshark.

Gymshark 1 Jul 6, 2021
BFKit-Swift is a collection of useful classes, structs and extensions to develop Apps faster.

Features β€’ Classes and Extensions Compatibility β€’ Requirements β€’ Communication β€’ Contributing β€’ Installing and Usage β€’ Documentation β€’ Changelog β€’ Exa

Fabrizio Brancati 992 Dec 2, 2022
Useful functions and extensions for sorting in Swift

SwiftSortUtils Motivation This library takes a shot at making comparing and sorting in Swift more pleasant. It also allows you to reuse your old NSSor

Daniel Strittmatter 60 Sep 9, 2022
Personally useful Swift Extensions for iOS Development

Useful-Swift-Extensions Personally useful Swift Extensions for iOS Development; cobbled together from a variety of development projects and StackOverf

Nick Arner 5 Dec 13, 2021
Extendy - A set of useful string extensions.

Extendy A set of useful string extensions. Requirements iOS 11.0+ Swift 5+ Installation CocoaPods Extendy is available through CocoaPods. To install i

Anton Novichenko 3 Sep 23, 2021
An open source Instapaper clone that features apps and extensions that use native UI Components for Mac and iOS.

TODO: Screenshot outdated Hipstapaper - iOS and Mac Reading List App A macOS, iOS, and iPadOS app written 100% in SwiftUI. Hipstapaper is an app that

Jeffrey Bergier 51 Nov 15, 2022
SwiftExtensionsPlayground - This playground includes some extensions that I like to use

This playground includes some extensions that I like to use. You can find exampl

FΔ±rat YenidΓΌnya 0 Jan 6, 2022
WholesomeExtensions - A SPM package that provides some extensions that I like to use

WholesomeExtensions This package includes some extensions that I like to use. Yo

FΔ±rat YenidΓΌnya 2 Dec 30, 2022
LibAuthentication will simplify your code when if you want to use FaceID/TouchID in your tweaks.

LibAuthentication will simplify your code when if you want to use FaceID/TouchID in your tweaks.

Maximehip 6 Oct 3, 2022
iOS helper library that contains commonly used code in Uptech iOS projects

iOS helper library that contains commonly used code in Uptech iOS projects.

Uptech 1 Apr 1, 2022
Collection of native Swift extensions to boost your development. Support tvOS and watchOS.

SparrowKit Collection of native Swift extensions to boost your development. Support iOS, tvOS and watchOS. If you like the project, don't forget to pu

Ivan Vorobei 119 Dec 20, 2022
A handy collection of more than 500 native Swift extensions to boost your productivity.

SwifterSwift is a collection of over 500 native Swift extensions, with handy methods, syntactic sugar, and performance improvements for wide range of

SwifterSwift 12k Jan 7, 2023
A collection of useful result builders for Swift and Foundation value types

Swift Builders A collection of useful result builders for Swift and Foundation value types. Motivation Arrays, dictionaries, and other collection-base

David Roman 3 Oct 14, 2022
A Collection of useful Swift property wrappers to make coding easier

Swift Property Wrappers A Collection of useful Swift property wrappers to make c

Gordan GlavaΕ‘ 2 Jan 28, 2022
FeatureFlags.swift - Tools for easily defining feature flags for your projects

FeatureFlags.swift Tools for easily defining feature flags for your projects Int

Eric Rabil 1 Jan 31, 2022
BFKit is a collection of useful classes and categories to develop Apps faster.

Swift Version β€’ What does it do β€’ Language support β€’ Requirements β€’ Communication β€’ Contributing β€’ Installing and Usage β€’ Documentation β€’ Changelog β€’

Fabrizio Brancati 806 Dec 2, 2022
A Swift package for rapid development using a collection of micro utility extensions for Standard Library, Foundation, and other native frameworks.

ZamzamKit ZamzamKit is a Swift package for rapid development using a collection of micro utility extensions for Standard Library, Foundation, and othe

Zamzam Inc. 261 Dec 15, 2022
Extensions for Swift Standard Types and Classes

Cent Cent is a library that extends certain Swift object types using the extension feature and gives its two cents to Swift language. Dollar is a Swif

Ankur Patel 225 Dec 7, 2022
A ΞΌframework of extensions for SequenceType in Swift 2.0, inspired by Python's itertools, Haskell's standard library, and other things.

SwiftSequence Full reference here. (If you're looking for data structures in Swift, those have been moved to here) SwiftSequence is a lightweight fram

Donnacha OisΓ­n Kidney 376 Oct 12, 2022