ShitLib 4.0.0

ShitLib 4.0.0

Cristina De Rito 维护。



ShitLib 4.0.0

  • 作者
  • artemisia-absynthium

ShitLib (oh Shit!)

Build Status License Platform Codacy Badge Version Carthage compatible Swift Package Manager compatible Join the chat at https://gitter.im/ShitLib/shitlib-swift

安装

CocoaPods

ShitLib 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile

pod 'ShitLib', '~> 4.0'

Carthage

ShitLib 与 Carthage 兼容。要使用它,请将以下行添加到您的 Cartfile

github "ShitLib/shitlib-swift" ~> 4.0.0

Swift 包管理器

ShitLib 与 Swift 包管理器 兼容。要使用它,将以下内容添加到您的 Package.swift 文件中作为依赖项

.package(url: "https://github.com/ShitLib/shitlib-swift.git", .upToNextMajor(from: "4.0.0"))

要求

iOS 8.0
OS X 10.9
tvOS 9.0
watchOS 2.0

你希望移除的唯一库!

这个库帮助你记住做错的事情。有了ShitLib,你将始终意识到应用程序内部的糟糕代码。

用法

你正在编写不想要的代码吗?你害怕你正在做什么吗?使用ShitLib来参考你的糟糕代码,这样你就可以记住它。怎么做?移除ShitLib依赖项,你的代码将无法编译,直到你移除所有的糟糕代码。

你的老板强迫你去拿到一个列表的第一个元素,你知道这是错误的:你可以使用OhShit!

import ShitLib

class MyBeautifulClass {


    let elements: [String] = [**some elements inside**]


    func iDontWantToDoThisButWeMustReleaseASAP() {
        let element = elements[OhShit.os0] // <--- OhShit Constant
        doSomeThing(with: element)
    }

    func doSomeThing(with element: String) {
        // anything
    }


}

你认为使用这个库有什么便利之处?很简单,这是当从依赖项中去除时最有用的库。这样做之后,你的项目将无法编译,你将立即意识到应该做什么。修复它!

ShitLib的其他用法?让我们试一下方法API

import ShitLib

class MyBeautifulUnconfigurableClass {


    enum PasswordError: Error {
        case length(maxLength: Int)
    }

    let maxPasswordSize: Int = OhShit.ohShit(7)! // I cannot parameterize now


    public func set(password: String) throws {
        if password.count > maxPasswordSize {
            throw PasswordError.length(maxLength: maxPasswordSize)
        }
    }


}

有什么新变化?

查看我们的变更日志

许可证

ShitLib遵循MIT许可。有关更多信息,请参阅LICENSE文件。