Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
sboh1214 committed Jan 19, 2021
1 parent 0d83ab5 commit 018f494
Show file tree
Hide file tree
Showing 25 changed files with 633 additions and 160 deletions.
64 changes: 64 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## User settings
xcuserdata/

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3

## Obj-C/Swift specific
*.hmap

## App packaging
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
# *.xcodeproj
#
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
# hence it is not needed unless you have added a package configuration file to your project
# .swiftpm

.build/

# fastlane
#
# It is recommended to not store the screenshots in the git repo.
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output

# Custom
.DS_Store

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"object": {
"pins": [
{
"package": "BitByteData",
"repositoryURL": "https://github.com/tsolomko/BitByteData",
"state": {
"branch": null,
"revision": "3ee55b113ae52d5c1f4cbec0ed4eae613dcd7eff",
"version": "1.4.3"
}
},
{
"package": "Hwp-Swift",
"repositoryURL": "https://github.com/sboh1214/Hwp-Swift.git",
"state": {
"branch": null,
"revision": "ae21bf695c0f35686e62b795023bd9d0a0a6fbd9",
"version": "0.11.0"
}
},
{
"package": "OLEKit",
"repositoryURL": "https://github.com/CoreOffice/OLEKit.git",
"state": {
"branch": null,
"revision": "c78476f851d7333c1e479c663731654a3b377a18",
"version": "0.3.0"
}
},
{
"package": "SWCompression",
"repositoryURL": "https://github.com/tsolomko/SWCompression.git",
"state": {
"branch": null,
"revision": "4fa4adcf5bbf263388edcbf2631987039a84b389",
"version": "4.5.7"
}
}
]
},
"version": 1
}

This file was deleted.

19 changes: 19 additions & 0 deletions Shared/Content/ContentView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import SwiftUI

struct ContentView: View {
var body: some View {
ScrollView {
#if os(iOS)
UIHwpView()
#elseif os(macOS)
NSHwpView()
#endif
}
}
}

struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
20 changes: 20 additions & 0 deletions Shared/Content/NSHwpView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import SwiftUI

struct NSHwpView: NSViewRepresentable {
typealias NSViewType = NSTextView

func makeNSView(context: Context) -> NSViewType {
let view = NSTextView()
return view
}

func updateNSView(_ nsView: NSViewType, context: Context) {

}
}

struct NSHwpView_Previews: PreviewProvider {
static var previews: some View {
NSHwpView()
}
}
20 changes: 20 additions & 0 deletions Shared/Content/UIHwpView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import SwiftUI

struct UIHwpView: UIViewRepresentable {
typealias UIViewType = UIView

func makeUIView(context: Context) -> UIViewType {
let view = UIView()
return view
}

func updateUIView(_ uiView: UIViewType, context: Context) {

}
}

struct UIHwpView_Previews: PreviewProvider {
static var previews: some View {
UIHwpView()
}
}
22 changes: 0 additions & 22 deletions Shared/ContentView.swift

This file was deleted.

30 changes: 30 additions & 0 deletions Shared/LikeHangulApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import SwiftUI

@main
struct LikeHangulApp: App {
var body: some Scene {
DocumentGroup(newDocument: LikeHangulDocument()) { file in
MainView(document: file.$document)
}
.commands {
ToolbarCommands()
SidebarCommands()
CommandGroup(replacing: CommandGroupPlacement.appInfo) {
Button("한글다운에 관하여...") {

}
}
}
// WindowGroup("About") {
// AboutView()
// }

#if os(macOS)
Settings {
PreferencesView()
.padding(20)
.frame(width: 375, height: 150)
}
#endif
}
}
27 changes: 27 additions & 0 deletions Shared/LikeHangulDocument.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import SwiftUI
import UniformTypeIdentifiers
import CoreHwp

extension UTType {
static var hwp: UTType {
UTType(importedAs: "com.haansoft.HancomOfficeViewer.mac.hwp")
}
}

struct LikeHangulDocument: FileDocument {
var hwp: HwpFile

init() {
hwp = HwpFile()
}

static var readableContentTypes: [UTType] { [.hwp] }

init(configuration: ReadConfiguration) throws {
hwp = try HwpFile(fromWrapper: configuration.file)
}

func fileWrapper(configuration: WriteConfiguration) throws -> FileWrapper {
throw CocoaError(.persistentStoreSave)
}
}
17 changes: 0 additions & 17 deletions Shared/Like_HangulApp.swift

This file was deleted.

39 changes: 0 additions & 39 deletions Shared/Like_HangulDocument.swift

This file was deleted.

43 changes: 43 additions & 0 deletions Shared/MainView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import SwiftUI

struct MainView: View {
@Binding var document: LikeHangulDocument

@State var isFileInfoPresented: Bool = false

var body: some View {
NavigationView {
Group {
SidebarView()
ContentView()
}
}.toolbar {
#if os(macOS)
ToolbarItem(placement: .navigation){
Button(action: toggleSidebar) {
Image(systemName: "sidebar.left")
}
}
#endif
ToolbarItem(placement: .automatic) {
Button(action: {isFileInfoPresented = true}) {
Image(systemName: "info.circle")
}
}
}.sheet(isPresented: $isFileInfoPresented) {
FileInfoView(header: document.hwp.fileHeader, toggleSheet: {isFileInfoPresented = false})
}
}
}

#if os(macOS)
func toggleSidebar() {
NSApp.keyWindow?.firstResponder?.tryToPerform(#selector(NSSplitViewController.toggleSidebar(_:)), with: nil)
}
#endif

struct MainView_Previews: PreviewProvider {
static var previews: some View {
MainView(document: .constant(LikeHangulDocument()))
}
}
13 changes: 13 additions & 0 deletions Shared/Preferences/AdvancedView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import SwiftUI

struct AdvancedView: View {
var body: some View {
Text("Advanced")
}
}

struct AdvancedView_Previews: PreviewProvider {
static var previews: some View {
AdvancedView()
}
}
Loading

0 comments on commit 018f494

Please sign in to comment.