Releases: RakuyoKit/JSONPreview
Releases · RakuyoKit/JSONPreview
1.2.3 - Adapt Xcode12.5
Fix
- Adapt to Xcode12.5.
1.2.2 - Escaped String
Fix
- Fixed the problem of incorrectly judging the end of a string with
\"
in the string.
1.2.1 - Change Detection
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
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
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
Fix:
- Fixed an issue where loading the default image failed.
- Fixed a program crash when displaying empty json.