Skip to content

Releases: RakuyoKit/JSONPreview

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