Just a bunch of typealeases for the AppKit in Cocoa.
Just import UICocoa
instead of import Cocoa
(or AppKit).
Gives an abitily to use UI prefixed equivalents of NS prefixed classes from the AppKit.
(Only for classes, with UIKit equivalents)
Includes CoreData export, just like Cocoa, so import UICocoa
already contains import CoreData
and there is no need to code twice.
Makes the development of cross-platform UI frameworks a little bit easier, reduces the amount of boilerplate code.
Replace this
#if os(iOS)
import UIKit
extension UIView {
func roundCorners(by value: CGFloat) {
layer.cornerRadius = value
}
}
#elseif os(OSX)
import AppKit // or Cocoa
extension NSView {
func roundCorners(by value: CGFloat) {
layer.cornerRadius = value
}
}
#endif
with this
import UICocoa
extension UIView {
func roundCorners(by value: CGFloat) {
layer.cornerRadius = value
}
}
Via SwiftPM, just add a link to this repo to your Package.swift file.
.package(url: "https://github.com/maximkrouk/UICocoa.git", from: "1.0.0")
Or use XCodePM
UICocoa is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'UICocoa'
and run pod install
from the terminal.
UICocoa is available under the MIT license. See the LICENSE file for more info.
Feel free to contribute or communicate.