Graph
  • March 28, 2024

Welcome to Graph

Graph is a semantic database that is used to create data-driven applications.


Features


  •  iCloud Support
  •  Multi Local & Cloud Graphs
  •  Thread Safe
  •  Store Any Data Type, Including Binary Data
  •  Relationship Modeling
  •  Action Modeling For Analytics
  •  Model With Graph Theory and Set Theory
  •  Asynchronous / Synchronous Search
  •  Asynchronous / Synchronous Saving
  •  Data-Driven Architecture
  •  Data Model Observation
  •  Comprehensive Unit Test Coverage
  •  Example Projects

Requirements


  • iOS 8.0+ / Mac OS X 10.10+
  • Xcode 8.0+

Communication


  • If you need help, use Stack Overflow. (Tag ‘cosmicmind’)
  • If you’d like to ask a general question, use Stack Overflow.
  • If you found a bugand can provide steps to reliably reproduce it, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

Installation


Embedded frameworks require a minimum deployment target of iOS 8.

CocoaPods


CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate Graph’s core features into your Xcode project using CocoaPods, specify it in your Podfile:

source ‘https://github.com/CocoaPods/Specs.git’
platform :ios, ‘8.0’
use_frameworks!

pod ‘Graph’, ‘~> 3.1.0’

Then, run the following command:

$ pod install

Carthage


Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate Graph into your Xcode project using Carthage, specify it in your Cartfile:

github “CosmicMind/Graph”

Run carthage update to build the framework and drag the built Graph.framework into your Xcode project.

Changelog


Graph is a growing project and will encounter changes throughout its development. It is recommended that the Changelog be reviewed prior to updating versions.

Samples


The following are samples to see how Graph may be used within your applications.

  • Visit the Samples repo to see example projects using Graph.

Creating an Entity for an ImageCard


An Entity is a model (data) object that represents a personplace, or thing. It may store property values, be a member of groups, and can be tagged.

In the following example, we create an ImageCard view using Material and populate it’s properties with an Entity that stores the data for that view.

Creating data

let graph = Graph()

let entity = Entity(type: “ImageCard”)
entity[“title”] = “Graph”
entity[“detail”] = “Build Data-Driven Software”
entity[“content”] = “Graph is a semantic database that is used to create data-driven applications.”
entity[“author”] = “CosmicMind”
entity[“image”] = UIImage.load(contentsOfFile: “frontier”, ofType: “jpg”)

graph.sync()

Setting the view’s properties

imageCard.toolbar?.title = entity[“title”] as? String
imageCard.toolbar?.detail = entity[“detail”] as? String
imageCard.imageView?.image = entity[“image”] as? UIImage

let contentLabel = UILabel()
contentLabel.text = entity[“content”] as? String
imageCard.contentView = contentLabel

let authorLabel = UILabel()
authorLabel.text = entity[“author”] as? String
imageCard.bottomBar?.centerViews = [authorLabel]

Searching a list of users in realtime


Using the Search API is incredibly flexible. In the following example, Search is used to create a live search on user names with a dynamic UI provided by Material’s SearchBar.

Preparing the search criteria

let graph = Graph()

let search = Search<Entity>(graph: graph).for(types: “User”).where(properties: “name”)

Asynchronously searching graph

search.async { [weak self, pattern = pattern] (users) in
guard let regex = try? NSRegularExpression(pattern: pattern, options: []) else {
    return
    }
var data = [Entity]()
for user in users {
if let name = user[“name”] as? String {
let matches = regex.matches(in: name, range: NSRange(location: 0, length: name.utf16.count))
if 0 < matches.count {
data.append(user)
}
}
}
self?.tableView.data = data
}

GitHub


View Github

#coredata #cosmicmind #data #data-driven #data-driven-design #data-driven-workflows #database #graph #graph-theory #icloud #icloud-sync #semantic-database #swift #swift-3
YOU MIGHT ALSO LIKE...
exyte

     

camerakit-ios

CameraKit helps you add reliable camera to your app quickly. Our open source camera platform provides consistent capture results, service ...

HybridCamera

[video width="192" height="416" mp4="https://swiftgit.com/wp-content/uploads/2024/12/68747470733a2f2f7261776769742e636f6d2f7374796c656b69742f696d672f6d61737465722f7669645f6564697465645f325f326d622e676966.mp4"][/video]

TakeASelfie

An iOS framework that uses the front camera, detects your face and takes a selfie. This api opens the front ...

iOS-Depth-Sampler

Code examples of Depth APIs in iOS