Skip to content

Releases: RakuyoKit/JSONPreview

1.3.0 - Compromise Updates

23 Sep 07:30
Compare
Choose a tag to compare

In this version, we were forced to remove the JSONPreview diagonal sliding feature. There were too many problems with this feature due to personal incompetence, and we couldn't fix it at the same time. Finally we removed this feature.

Add

  • Add JSONPreviewDelegate, which is used to replace the previous use of UITextViewDelegate to realize the URL click.

Change

  • Since JSON is now displayed in line breaks, the line height is no longer a fixed value.
  • Improved the judgment rules for URLs, and now IP addresses can be correctly identified as URLs.

Remove

  • Removed the diagonal swipe feature.

1.2.3 - Adapt Xcode12.5

22 Sep 05:55
Compare
Choose a tag to compare

Fix

  • Adapt to Xcode12.5.

1.2.2 - Escaped String

30 Nov 08:41
Compare
Choose a tag to compare

Fix

  • Fixed the problem of incorrectly judging the end of a string with \" in the string.

1.2.1 - Change Detection

23 Oct 06:46
Compare
Choose a tag to compare

Fix

  • Fixed an issue where JSON could not be previewed due to the use of regular detection URLs.

In version 1.2.0, we use **regular ** to detect whether a string is a URL.

((https|http|ftp|rtsp|igmp|file|rtspt|rtspu)://)?((\\w)*|([0-9]*)|([-|_])*)+([\\.|/]((\\w)*|([0-9]*)|([-|_])*))+

It has been tested when the JSON content is very complex, such as {"address" : "0x97463213"}.

At this time, if you judge by this method, there will be no result for the method call and the method will just end. As a result, JSON cannot be displayed.

So in version 1.2.1, we have changed the way URLs are determined. The NSDataDetector type is used instead:

var isValidURL: String? {

    guard count > 1 else { return nil }
    
    guard let detector = try? NSDataDetector(
        types: NSTextCheckingResult.CheckingType.link.rawValue
    ) else { return nil }

    let string = removeEscaping()

    let matches = detector.matches(in: string, options: [], range: NSRange(location: 0, length: string.utf16.count))
    
    return matches.isEmpty ? nil : string
}

1.2.0 - Support Link

23 Oct 02:59
Compare
Choose a tag to compare

Add

Core

  • Add the ability to render links.
  • When this value is judged to be link, the "Replace escaped character" operation is executed.

Demo

  • Added new sample code: After clicking the link, use SFSafariViewController to open the corresponding page.

Fix

  • Improved the display of line number. (Achieved by adding LineNumberCell type)

1.1.0 - Completion Callback

26 Sep 07:08
Compare
Choose a tag to compare

Add

The preview(_:style:) method adds a completion callback. The caller can now be notified when data processing is complete.

The full definition of the method is now as follows.

/// Preview json.
///
/// - Parameters:
///   - json: The json to be previewed
///   - style: Highlight style. See `HighlightStyle` for details.
///   - completion: Callback after data processing is completed.
func preview(_ json: String, style: HighlightStyle = .default, completion: (() -> Void)? = nil) 

1.0.1 - Fix Bugs

26 Sep 07:10
Compare
Choose a tag to compare

Fix:

  • Fixed an issue where loading the default image failed.
  • Fixed a program crash when displaying empty json.

1.0.0 - Initial Release

18 Sep 06:32
Compare
Choose a tag to compare