SBObjectiveCWrapper

master

Objective-C Wrapper for SwiftyBeaver Logger (Swift 2, 3, 4 & 5!)
SwiftyBeaver/SBObjectiveCWrapper

SBObjectiveCWrapper

Platform iOS 8+ Platform Mac OS X 10.9+ Platform Platform
Language Swift 4.0 Carthage compatible Accio supported Cocoapods compatible

SBObjectiveCWrapper enables you to use SwiftyBeaver logging in your Objective-C code.

Requirements

  • iOS 9.0+ / Mac OS X 10.9+
  • Xcode 9+

Installation

Platform & Installation Support

\ iOS 9+ OSX 10.9+ watchOS 2+ tvOS 9+
Carthage
CocoaPods
Download

For installation details please see the next points.

via Carthage

You can use Carthage to install SBObjectiveCWrapper by adding this to your Cartfile:

Swift 3.0

github "SwiftyBeaver/SBObjectiveCWrapper"

Swift 2.3

github "SwiftyBeaver/SwiftyBeaver" ~> 0.7

This will also install SwiftyBeaver if it is not installed already.

via CocoaPods

To use CocoaPods just add this to your Podfile:

Swift 3.0

pod 'SBObjectiveCWrapper', '~> 1.1.0'

Swift 2.3

pod 'SBObjectiveCWrapper', '~> 0.7.0'

This will also install SwiftyBeaver if it is not installed already.

or Download

Prerequisite: Make sure you have SwiftyBeaver installed! Follow the installation directions here: SwiftyBeaver

  1. Download the latest source code.
  2. Drag & drop the /sources folder into your project (make sure "Copy items if needed" is checked)
  3. Rename the "sources" group to "SBObjectiveCWrapper" if you'd like

Usage

Let's go!

In order to use the SwiftyBeaver Objective-C Wrapper you must get your logging environment setup using Swift.

If you already have SwiftyBeaver working with Swift you can skip ahead to the Objective-C section.

###SwiftyBeaver Setup

A more detailed example of setting up SwiftyBeaver can be seen in the SwiftyBeaver readme. Below are the minimum steps you need to do in your AppDelegate.swift file to get logging working:

Near the top:

import SwiftyBeaver
let log = SwiftyBeaver.self

This makes the log variable accessible to any of your Swift files.

We then need to add a destination. This should happen as early as possible (most likely in your appDelegate:didFinishLaunchingWithOptions() method). Here we add a console destination:

let console = ConsoleDestination()  // log to Xcode Console
log.addDestination(console)

Objective-C

Once you can log from Swift now you can import SBObjectiveCWrapper into any of your Objective-C .m files:

@import SBObjectiveCWrapper;

This allows you to use the following logging macros:

SBLogVerbose(@"This is a verbose message.");
SBLogDebug(@"This is a debug message.");
SBLogInfo(@"This is an info message.");
SBLogWarning(@"This is a warning message.");
SBLogError(@"This is an error message.");

Contact & Contribute

If you have questions please contact us via the dedicated SwiftyBeaver Twitter account. Feature requests or bugs are better reported and discussed as Github Issue.

License

SBObjectiveCWrapper is released under the MIT License.

Description

  • Swift Tools 4.2.0
View More Packages from this Author

Dependencies

Last updated: Sun Mar 17 2024 10:44:59 GMT-0900 (Hawaii-Aleutian Daylight Time)