68b9db4d11
Converts iOS implementation from Objective-c to Swift # During the conversion process some updates to the code structure were also made - Modularize codebase from single file to smaller focused files - Untangled large nested IF statements - Added more null checks, since Swift is more strict with null pointers - Added property to allow for decoding of local video sources with self contained key for offline playback - Updates example apps to test react-native 0.63.4 and uses auto native dependency imports for android and ios
54 lines
1.7 KiB
Swift
54 lines
1.7 KiB
Swift
//
|
|
// RCTLog.swift
|
|
// WebViewExample
|
|
//
|
|
// Created by Jimmy Dee on 4/5/17.
|
|
// Copyright © 2017 Branch Metrics. All rights reserved.
|
|
//
|
|
|
|
/*
|
|
* Under at least some conditions, output from NSLog has been unavailable in the RNBranch module.
|
|
* Hence that module uses the RCTLog macros from <React/RCTLog.h>. The React logger is nicer than
|
|
* NSLog anyway, since it provides log levels with runtime filtering, file and line context and
|
|
* an identifier for the thread that logged the message.
|
|
*
|
|
* This wrapper lets you use functions with the same name in Swift. For example:
|
|
*
|
|
* RCTLogInfo("application launched")
|
|
*
|
|
* generates
|
|
*
|
|
* 2017-04-06 12:31:09.611 [info][tid:main][AppDelegate.swift:18] application launched
|
|
*
|
|
* This is currently part of this sample app. There may be some issues integrating it into an
|
|
* Objective-C library, either react-native-branch or react-native itself, but it may find its
|
|
* way into one or the other eventually. Feel free to reuse it as desired.
|
|
*/
|
|
|
|
func RCTLogError(_ message: String, _ file: String=#file, _ line: UInt=#line) {
|
|
RCTSwiftLog.error(message, file: file, line: line)
|
|
}
|
|
|
|
func RCTLogWarn(_ message: String, _ file: String=#file, _ line: UInt=#line) {
|
|
RCTSwiftLog.warn(message, file: file, line: line)
|
|
}
|
|
|
|
func RCTLogInfo(_ message: String, _ file: String=#file, _ line: UInt=#line) {
|
|
RCTSwiftLog.info(message, file: file, line: line)
|
|
}
|
|
|
|
func RCTLog(_ message: String, _ file: String=#file, _ line: UInt=#line) {
|
|
RCTSwiftLog.log(message, file: file, line: line)
|
|
}
|
|
|
|
func RCTLogTrace(_ message: String, _ file: String=#file, _ line: UInt=#line) {
|
|
RCTSwiftLog.trace(message, file: file, line: line)
|
|
}
|
|
|
|
func DebugLog(_ message: String) {
|
|
#if DEBUG
|
|
print(message)
|
|
#endif
|
|
}
|
|
|