Skip to content
This repository has been archived by the owner on Jan 11, 2019. It is now read-only.

Commit

Permalink
initial comit
Browse files Browse the repository at this point in the history
  • Loading branch information
icanzilb committed Jul 4, 2017
0 parents commit 1f21830
Show file tree
Hide file tree
Showing 33 changed files with 2,457 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
Example/Pods
Example/RealmContent.xcworkspace
12 changes: 12 additions & 0 deletions Example/Podfile
@@ -0,0 +1,12 @@
use_frameworks!

target 'RealmContent_Example' do
pod 'RealmSwift'

pod 'RealmContent', :path => '../'
#pod 'RealmContent/Markdown', :path => '../'

target 'RealmContent_Tests' do
inherit! :search_paths
end
end
631 changes: 631 additions & 0 deletions Example/RealmContent.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
BuildableName = "RealmContent_Example.app"
BlueprintName = "RealmContent_Example"
ReferencedContainer = "container:RealmContent.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACE41AFB9204008FA782"
BuildableName = "RealmContent_Tests.xctest"
BlueprintName = "RealmContent_Tests"
ReferencedContainer = "container:RealmContent.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACE41AFB9204008FA782"
BuildableName = "RealmContent_Tests.xctest"
BlueprintName = "RealmContent_Tests"
ReferencedContainer = "container:RealmContent.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
BuildableName = "RealmContent_Example.app"
BlueprintName = "RealmContent_Example"
ReferencedContainer = "container:RealmContent.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
BuildableName = "RealmContent_Example.app"
BlueprintName = "RealmContent_Example"
ReferencedContainer = "container:RealmContent.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
BuildableName = "RealmContent_Example.app"
BlueprintName = "RealmContent_Example"
ReferencedContainer = "container:RealmContent.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>607FACCF1AFB9204008FA782</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>607FACE41AFB9204008FA782</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>
63 changes: 63 additions & 0 deletions Example/RealmContent/AppDelegate.swift
@@ -0,0 +1,63 @@
//
// AppDelegate.swift
//
// Created by Marin Todorov
// Copyright © 2017 - present Realm. All rights reserved.
//

import UIKit
import RealmSwift

/// configuration
let shouldConnectToROS = true
let host = "localhost"
let username = "test@host"
let password = "password"

/// app delegate
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

if shouldConnectToROS {
// syncs content from ROS
connect(host: host, username: username, password: password, completion: showMainViewController)

} else {
// shows content from local realm
showMainViewController()
}

return true
}

private func showMainViewController(success: Bool = true) {
let storyboard = self.window!.rootViewController!.storyboard!
self.window!.rootViewController = storyboard.instantiateViewController(withIdentifier: "Main")
}
}

extension AppDelegate {
// connect to a Realm Object Server

func connect(host: String, username: String, password: String, completion: @escaping ((Bool)->Void) = {_ in}) {
let credentials = SyncCredentials.usernamePassword(username: username, password: password)
let serverUrl = URL(string: "http://\(host):9080")!

SyncUser.logIn(with: credentials, server: serverUrl) { user, error in
guard let user = user else {
DispatchQueue.main.async { completion(false) }
return
}

var conf = Realm.Configuration.defaultConfiguration
conf.syncConfiguration = SyncConfiguration(user: user, realmURL: URL(string: "realm://\(host):9080/~/realmcontenttest")!)
Realm.Configuration.defaultConfiguration = conf

DispatchQueue.main.async { completion(true) }
}
}
}
45 changes: 45 additions & 0 deletions Example/RealmContent/Base.lproj/LaunchScreen.xib
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16G16b" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB">
<rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text=" Copyright (c) 2015 CocoaPods. All rights reserved." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="8ie-xW-0ye">
<rect key="frame" x="20" y="439" width="441" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="RealmContent" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
<constraint firstAttribute="bottom" secondItem="8ie-xW-0ye" secondAttribute="bottom" constant="20" id="Kzo-t9-V3l"/>
<constraint firstItem="8ie-xW-0ye" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="MfP-vx-nX0"/>
<constraint firstAttribute="centerX" secondItem="8ie-xW-0ye" secondAttribute="centerX" id="ZEH-qu-HZ9"/>
<constraint firstItem="kId-c2-rCX" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="20" symbolic="YES" id="fvb-Df-36g"/>
</constraints>
<nil key="simulatedStatusBarMetrics"/>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="548" y="455"/>
</view>
</objects>
</document>
109 changes: 109 additions & 0 deletions Example/RealmContent/Base.lproj/Main.storyboard
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16G16b" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="33S-bn-uEv">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Content-->
<scene sceneID="ufC-wZ-h7g">
<objects>
<viewController id="vXZ-lx-hvc" customClass="ViewController" customModule="RealmContent_Example" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/>
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="55" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="8bb-dC-cYX">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" rowHeight="55" id="MRs-4Z-h3A">
<rect key="frame" x="0.0" y="56" width="375" height="55"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="MRs-4Z-h3A" id="9Q2-0W-UhX">
<rect key="frame" x="0.0" y="0.0" width="375" height="54.5"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="vXZ-lx-hvc" id="prl-gW-F1n"/>
<outlet property="delegate" destination="vXZ-lx-hvc" id="pp5-nP-732"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="2fi-mo-0CV" firstAttribute="top" secondItem="8bb-dC-cYX" secondAttribute="bottom" id="4gH-Ig-QiX"/>
<constraint firstItem="8bb-dC-cYX" firstAttribute="top" secondItem="kh9-bI-dsS" secondAttribute="top" id="Ipk-ea-KNV"/>
<constraint firstAttribute="trailing" secondItem="8bb-dC-cYX" secondAttribute="trailing" id="mQV-nr-Me7"/>
<constraint firstItem="8bb-dC-cYX" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leading" id="vQz-GM-7YV"/>
</constraints>
</view>
<navigationItem key="navigationItem" title="Content" id="CJZ-Ql-N1H"/>
<connections>
<outlet property="tableView" destination="8bb-dC-cYX" id="25c-XJ-tAQ"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="782.5" y="34.5"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="R1k-wW-g4d">
<objects>
<navigationController storyboardIdentifier="Main" automaticallyAdjustsScrollViewInsets="NO" id="CMd-Qf-Bja" sceneMemberID="viewController">
<toolbarItems/>
<navigationBar key="navigationBar" contentMode="scaleToFill" id="2sT-Dk-QYx">
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
</navigationBar>
<nil name="viewControllers"/>
<connections>
<segue destination="vXZ-lx-hvc" kind="relationship" relationship="rootViewController" id="8qV-kK-4DW"/>
</connections>
</navigationController>
<placeholder placeholderIdentifier="IBFirstResponder" id="aWR-Yb-Imx" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="24.800000000000001" y="34.632683658170919"/>
</scene>
<!--View Controller-->
<scene sceneID="fuD-qb-ad8">
<objects>
<viewController id="33S-bn-uEv" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="seq-D0-b1h"/>
<viewControllerLayoutGuide type="bottom" id="hO0-Va-jDF"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="7rC-Sc-P8z">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" animating="YES" style="white" translatesAutoresizingMaskIntoConstraints="NO" id="rzb-MU-RU9">
<rect key="frame" x="177.5" y="323.5" width="20" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="3eW-px-Qpk"/>
<constraint firstAttribute="width" constant="20" id="iGO-qh-Kgm"/>
</constraints>
</activityIndicatorView>
</subviews>
<color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="rzb-MU-RU9" firstAttribute="centerY" secondItem="7rC-Sc-P8z" secondAttribute="centerY" id="iVg-m1-gnq"/>
<constraint firstItem="rzb-MU-RU9" firstAttribute="centerX" secondItem="7rC-Sc-P8z" secondAttribute="centerX" id="wok-eO-4Q8"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="Ye1-O6-Ki4" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="-798" y="34"/>
</scene>
</scenes>
</document>

0 comments on commit 1f21830

Please sign in to comment.