latest and greatest

This commit is contained in:
Kevin G Christiano 2020-01-28 11:54:24 -05:00
parent 57f71aca75
commit 9c8a55cc82
3 changed files with 28 additions and 4 deletions

View File

@ -21,6 +21,7 @@
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
0A5DD26123E0831500B3B076 /* AtomicAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A5DD26023E0831500B3B076 /* AtomicAPI.swift */; };
0AA7BDD2230DA06D00EED90B /* MolecularModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AA7BDD1230DA06D00EED90B /* MolecularModel.swift */; };
0ADD8082231055F500A5E643 /* ObjectParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ADD8081231055F500A5E643 /* ObjectParser.swift */; };
0ADD8086231056FF00A5E643 /* ObjectCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0ADD8085231056FF00A5E643 /* ObjectCell.swift */; };
@ -57,6 +58,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
0A5DD26023E0831500B3B076 /* AtomicAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AtomicAPI.swift; sourceTree = "<group>"; };
0AA7BDD1230DA06D00EED90B /* MolecularModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MolecularModel.swift; sourceTree = "<group>"; };
0ADD8081231055F500A5E643 /* ObjectParser.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObjectParser.swift; sourceTree = "<group>"; };
0ADD8085231056FF00A5E643 /* ObjectCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ObjectCell.swift; sourceTree = "<group>"; };
@ -137,6 +139,7 @@
D2B1E40922F4C9F00065F95C /* JSON */,
D2B1E3FD22F4A6930065F95C /* LaunchScreen.storyboard */,
D2B1E40022F4A6930065F95C /* Info.plist */,
0A5DD26023E0831500B3B076 /* AtomicAPI.swift */,
);
path = JSONCreator;
sourceTree = "<group>";
@ -251,6 +254,7 @@
buildActionMask = 2147483647;
files = (
0AA7BDD2230DA06D00EED90B /* MolecularModel.swift in Sources */,
0A5DD26123E0831500B3B076 /* AtomicAPI.swift in Sources */,
0ADD80882310570A00A5E643 /* ArrayCell.swift in Sources */,
D2B1E3F722F4A68F0065F95C /* DetailViewController.swift in Sources */,
0ADD8086231056FF00A5E643 /* ObjectCell.swift in Sources */,

View File

@ -0,0 +1,19 @@
//
// AtomicAPI.swift
// JSONCreator
//
// Created by Kevin Christiano on 1/28/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import Foundation
class AtomicAPI {
/// Pulls the latest state of a all stored structures in the the Atomic DB.
static func syncStructures() {
}
}

View File

@ -191,14 +191,15 @@ class MasterViewController: UIViewController, UITableViewDelegate, UITableViewDa
let molecularModel = MolecularModel()
molecularModel.category = categoryName as! String
let jsonContent = (content as! String).data(using: .utf8)
guard let categoryContent = try JSONSerialization.jsonObject(with: jsonContent!, options: []) as? [AnyHashable: Any] else { return }
guard let jsonContent = (content as? String)?.data(using: .utf8),
let categoryContent = try JSONSerialization.jsonObject(with: jsonContent, options: []) as? [AnyHashable: Any]
else { continue }
// Cycle through the molecules held by a category.
for (moleculeName, moleculeValue) in categoryContent {
let moleculeJSON = (moleculeValue as! String).data(using: .utf8)
guard let moldictionaryCat = try JSONSerialization.jsonObject(with: moleculeJSON!, options: []) as? [AnyHashable: Any] else { return }
guard let moleculeJSON = (moleculeValue as? String)?.data(using: .utf8),
let moldictionaryCat = try JSONSerialization.jsonObject(with: moleculeJSON, options: []) as? [AnyHashable: Any] else { continue }
molecularModel.molecules.append([moleculeName as! String: moldictionaryCat])
}