Skip to content

Just a bunch of typealeases for the AppKit and UIKit

License

Notifications You must be signed in to change notification settings

CaptureContext/cocoa-aliases

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cocoa-aliases

SwiftPM 5.9 Platforms @capture_context

Just a bunch of typealeases for the AppKit and UIKit.

This package gives an abitily to use Cocoa prefixed equivalents of NS prefixed classes from the AppKit and UI prefixed classes from UIKit (mostly for classes that have alternatives in these frameworks), makes the development of cross-platform UI frameworks a little bit easier, reduces the amount of boilerplate code.

So you can 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 CocoaAlises

extension CocoaView {
  func roundCorners(by value: CGFloat) {
    layer.cornerRadius = value
  }
}

Installation

Just add a link to this repo to your Package.swift file.

.package(
  name: "cocoa-alaises",
  url: "https://github.com/capturecontext/cocoa-alaises.git",
  .upToNextMajor(from: "2.1.0")
)
.product(
  name: "CocoaAlaises",
  package: "cocoa-alaises"
)

License

CocoaAliases is available under the MIT license. See the LICENSE file for more info.

About

Just a bunch of typealeases for the AppKit and UIKit

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 100.0%