Skip to content

AnimacX/bangumi-bbcode-swift

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bangumi BBCode Swift

A BBCode parser and render for Bangumi written in Swift.

Tested on both iOS and macOS.

inspired by: https://github.com/shiningdracon/BBCode-Swift

Usage

Parse BBCode to HTML mauanlly

import BBCode

let bbcode = "[b]Hello World[/b]"
let html = try! BBCode().html(code)

Show BBCode with SwiftUI Native Components

import SwiftUI
import BBCode

struct ContentView: View {
  let example = "[b]Hello World[/b]"

  var body: some View {
    ScrollView {
      BBCodeView(example).padding()
    }
  }
}

Show BBCode with WKWebView

import SwiftUI
import BBCode

struct ContentView: View {
  let example = "[b]Hello World[/b]"

  var body: some View {
    ScrollView {
      BBCodeWebView(example, textSize = 14)
    }
  }
}

Show BBCode with UITextView

import SwiftUI
import BBCode

struct ContentView: View {
  let example = "[b]Hello World[/b]"

  var body: some View {
    ScrollView {
      BBCodeUITextView(example).padding()
    }
  }
}

supported tags

  • b
  • i
  • u
  • s
  • img
  • mask
  • size
  • color
  • url
  • center
  • left
  • right
  • align
  • list
  • code
  • quote
  • photo
  • subject
  • user
  • smilies
  • email

About

A BBCode parser and render for Bangumi written in Swift.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 95.9%
  • HTML 4.1%