/UILogView

Custom UIView which provide a way to view logs not only in the Xcode console but also within the application itself

Primary LanguageSwiftBSD 2-Clause "Simplified" LicenseBSD-2-Clause

UILogView

Overview

UILogView is a project that aims to enhance the logging capabilities of your application. Its purpose is to provide a way to view logs not only in the Xcode console but also within the application itself. By leveraging a custom UIView called UILogView, you can easily incorporate this functionality into your project.

Description

UILogView allows you to display logs generated by your code directly within your application's user interface. It offers a convenient and visually appealing way to view and interact with logs.

Some of the key features of UILogView include:

  • Minimization and maximization: UILogView can be minimized or maximized to control its visibility within the application.
  • Positioning: You can move UILogView to different locations within the view hierarchy by adding it as a subview to your desired view or window.
  • Log copying: UILogView allows you to copy logs to the clipboard for easy sharing or reference.
  • Customization: You can customize the appearance of UILogView, including its size, colors, font, and more, through code.

Usage

There are two main ways to use UILogView in your project:

  1. Adding UILogView as a subview with parameters:
let logView = UILogView.addUILogView(
    on: self.view,
    point: nil,
    appearance: UILogViewAppearance(
        textColorAppearance: [
            .high: .red,
            .low: .white
        ]
    )
)

In this method, you add UILogView as a subview to the specified view, passing in any additional customization parameters you desire.

  1. Instantiating UILogView and adding it as a subview:
let logView = UILogView(
    point: CGPoint(x: 50, y: 50),
    appearance: UILogViewAppearance(
        textColorAppearance: [
            .high: .red,
            .low: .white
        ]
    )
)
self.view.addSubview(logView)

In this approach, you create an instance of UILogView with the desired customization options, such as the initial position, appearance, and more. Then, you add it as a subview to the desired view or window.

Also, you can simply print out the log as follows.

logView.send(log: Log(level: .high, text: "Hello world!"))

By using UILogView in your project, you can conveniently view and interact with logs directly within your application, providing a seamless debugging and monitoring experience.

Example:

UILogView Screenshot

Contact

Any comments on this project are welcome. Feel free to register for the issue.