项目作者: xmindltd

项目描述 :
XMind SDK for Swift
高级语言: Swift
项目地址: git://github.com/xmindltd/xmind-sdk-swift.git
创建时间: 2020-01-14T07:56:08Z
项目社区:https://github.com/xmindltd/xmind-sdk-swift

开源协议:MIT License

下载


XMind SDK in Swift

Swift Package Manager compatible
Carthage compatible
Language

This SDK enables you to create and modify xmind(.xmind) files, and it’s written in swift.

Supported Platforms:

  • iOS 9+

  • macOS 10.11+

Structure of XMind files

XMind file is a zip file which contains several components, including manifest, metadata, sheets and resources.

Resources contains all the resources of this xmind file that like images.

Metadata represents the version of xmind file and the creator.

Sheets contains all of the topics that belong to the each sheets(canvas).

Manifest lists primary files that contained in this xmind file.

Usage

If you create a new xmind file, you can directly operate sheets and topics after initializing a Workbook instance that represents a xmind file.

If you open an existing xmind file. You need call public func loadManifest() of Workbook after initializing a workbook to load some base informations. And now you can access the passwordHint to read and write the password hint. then, you need call public func loadContent(password: String? = nil) to load the metadata and sheets. When it’s loaded, you can operate sheets and topics.

Simple

  1. import XMindSDK
  2. ...
  3. ...
  4. let wb = try Workbook.open(filePath: filePath)// This file path which contains an existing xmind file.
  5. try wb.loadManifest()
  6. try wb.loadContent(password: "123456")
  7. let root = wb.allSheets.first!.rootTopic
  8. let sub1 = root.addSubTopic("Sub Topic 1")
  9. let sub2 = root.addSubTopic("Sub Topic 2")
  10. let sub3 = root.addSubTopic("Sub Topic 3")
  11. sub3.addSubTopic("Topic 4")
  12. sub3.addSubTopic("Topic 5")
  13. sub2.addMarker(Marker.Arrow.refresh)
  14. root.addMarker(Marker.Flag.darkBlue)
  15. sub1.addMarker(Marker.Priority.p2)
  16. try wb.save(to: filePath, password: "123456")

Fast Creating

  1. import XMindSDK
  2. ...
  3. ...
  4. let wb = try! workbook {
  5. topic(title: "Apple") {
  6. topic(title: "Hardware") {
  7. topic(title: "iPhone") {
  8. topic(title: "iPhone 6")
  9. topic(title: "iPhone 7 Plus")
  10. topic(title: "iPhone 8")
  11. topic(title: "iPhone XS Max")
  12. }
  13. topic(title: "Mac") {
  14. topic(title: "MacBook Pro")
  15. topic(title: "Mac mini")
  16. topic(title: "Mac Pro")
  17. }
  18. }
  19. topic(title: "Software") {
  20. topic(title: "Xcode")
  21. topic(title: "Siri")
  22. }
  23. }
  24. }
  25. try wb.save(to: filePath)

Read the Documents for all details.

Installation

  • Carthage

    1. github "xmindltd/xmind-sdk-swift"
  • Swift Package Manager

    1. .package(url: "https://github.com/xmindltd/xmind-sdk-swift.git", .upToNextMinor(from: "1.1.0"))

License

This SDK is released under the MIT license. See LICENSE for details.