Added macOS UI skeleton

pull/11/head
Cyril Zakka 1 year ago
parent 2bdfcc593d
commit d028c435c6

@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

@ -0,0 +1,58 @@
{
"images" : [
{
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

@ -0,0 +1,34 @@
//
// ContentView.swift
// Diffusion-macOS
//
// Created by Cyril Zakka on 1/12/23.
//
import SwiftUI
struct ContentView: View {
var body: some View {
NavigationSplitView {
PromptView()
.navigationSplitViewColumnWidth(min: 250, ideal: 300)
} detail: {
Image("placeholder")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 400, height: 400)
.cornerRadius(15)
.toolbar {
Button(action: {}) {
Label("share", systemImage: "square.and.arrow.up")
}
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}

@ -0,0 +1,10 @@
<?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>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
</dict>
</plist>

@ -0,0 +1,17 @@
//
// Diffusion_macOSApp.swift
// Diffusion-macOS
//
// Created by Cyril Zakka on 1/12/23.
//
import SwiftUI
@main
struct Diffusion_macOSApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}

@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

@ -0,0 +1,106 @@
//
// PromptView.swift
// Diffusion-macOS
//
// Created by Cyril Zakka on 1/12/23.
//
import SwiftUI
import CompactSlider
struct PromptView: View {
var models = ["hf-default-model"]
@State private var model = "hf-default-model"
@State private var positivePrompt = ""
@State private var negativePrompt = ""
@State private var steps = 50.0
@State private var numImages = 1.0
@State private var seed = 386.0
var body: some View {
VStack(alignment: .leading) {
Label("Adjustments", systemImage: "gearshape.2")
.font(.headline)
.fontWeight(.bold)
Divider()
ScrollView {
Group {
DisclosureGroup {
Picker("", selection: $model) {
ForEach(models, id: \.self) {
Text($0)
}
}
} label: {
Label("Model", systemImage: "cpu").foregroundColor(.secondary)
}
Divider()
DisclosureGroup {
Group {
TextField("Positive prompt", text: $positivePrompt,
axis: .vertical).lineLimit(5)
.textFieldStyle(.squareBorder)
.listRowInsets(EdgeInsets(top: 0, leading: -20, bottom: 0, trailing: 20))
TextField("Negative prompt", text: $negativePrompt,
axis: .vertical).lineLimit(5)
.textFieldStyle(.squareBorder)
}.padding(.leading, 10)
} label: {
Label("Prompts", systemImage: "text.quote").foregroundColor(.secondary)
}
Divider()
DisclosureGroup {
CompactSlider(value: $steps, in: 0...250, step: 5) {
Text("Steps")
Spacer()
Text("\(Int(steps))")
}.padding(.leading, 10)
} label: {
Label("Step count", systemImage: "square.3.layers.3d.down.left").foregroundColor(.secondary)
}
Divider()
DisclosureGroup() {
CompactSlider(value: $numImages, in: 0...10, step: 1) {
Text("Number of Images")
Spacer()
Text("\(Int(numImages))")
}.padding(.leading, 10)
} label: {
Label("Number of images", systemImage: "photo.stack").foregroundColor(.secondary)
}
Divider()
DisclosureGroup() {
CompactSlider(value: $seed, in: 0...1000, step: 1) {
Text("Random seed")
Spacer()
Text("\(Int(seed))")
}.padding(.leading, 10)
} label: {
Label("Random Seed", systemImage: "leaf").foregroundColor(.secondary)
}
}
}
Button {
// Generate image here
} label: {
Text("Generate")
.frame(maxWidth: .infinity)
.frame(height: 50)
}
.buttonStyle(.borderedProminent)
// StatusView()
}.padding()
}
}

@ -0,0 +1,20 @@
//
// StatusView.swift
// Diffusion-macOS
//
// Created by Cyril Zakka on 1/12/23.
//
import SwiftUI
struct StatusView: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}
struct StatusView_Previews: PreviewProvider {
static var previews: some View {
StatusView()
}
}

@ -22,6 +22,14 @@
EBE755E7293E37DE00806B32 /* DiffusionUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBE755E6293E37DE00806B32 /* DiffusionUITestsLaunchTests.swift */; };
EBE75602293E91E200806B32 /* Pipeline.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBE75601293E91E200806B32 /* Pipeline.swift */; };
EBE756092941178600806B32 /* Loading.swift in Sources */ = {isa = PBXBuildFile; fileRef = EBE756082941178600806B32 /* Loading.swift */; };
F15520242971093300DC009B /* Diffusion_macOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = F15520232971093300DC009B /* Diffusion_macOSApp.swift */; };
F15520262971093300DC009B /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F15520252971093300DC009B /* ContentView.swift */; };
F15520282971093400DC009B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F15520272971093400DC009B /* Assets.xcassets */; };
F155202B2971093400DC009B /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F155202A2971093400DC009B /* Preview Assets.xcassets */; };
F1552031297109C300DC009B /* PromptView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1552030297109C300DC009B /* PromptView.swift */; };
F155203229710A1300DC009B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EBE755CC293E37DD00806B32 /* Assets.xcassets */; };
F155203429710B3600DC009B /* StatusView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F155203329710B3600DC009B /* StatusView.swift */; };
F155203C297118E700DC009B /* CompactSlider in Frameworks */ = {isa = PBXBuildFile; productRef = F155203B297118E700DC009B /* CompactSlider */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -62,6 +70,14 @@
EBE755E6293E37DE00806B32 /* DiffusionUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DiffusionUITestsLaunchTests.swift; sourceTree = "<group>"; };
EBE75601293E91E200806B32 /* Pipeline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Pipeline.swift; sourceTree = "<group>"; };
EBE756082941178600806B32 /* Loading.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Loading.swift; sourceTree = "<group>"; };
F15520212971093300DC009B /* Diffusion-macOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Diffusion-macOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
F15520232971093300DC009B /* Diffusion_macOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Diffusion_macOSApp.swift; sourceTree = "<group>"; };
F15520252971093300DC009B /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
F15520272971093400DC009B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
F155202A2971093400DC009B /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
F155202C2971093400DC009B /* Diffusion_macOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Diffusion_macOS.entitlements; sourceTree = "<group>"; };
F1552030297109C300DC009B /* PromptView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PromptView.swift; sourceTree = "<group>"; };
F155203329710B3600DC009B /* StatusView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -89,6 +105,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
F155201E2971093300DC009B /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
F155203C297118E700DC009B /* CompactSlider in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
@ -109,6 +133,7 @@
EBE443892948953600CDA605 /* LICENSE */,
EBE755FF293E910800806B32 /* Packages */,
EBE755C7293E37DD00806B32 /* Diffusion */,
F15520222971093300DC009B /* Diffusion-macOS */,
EBE755D9293E37DE00806B32 /* DiffusionTests */,
EBE755E3293E37DE00806B32 /* DiffusionUITests */,
EBE755C6293E37DD00806B32 /* Products */,
@ -122,6 +147,7 @@
EBE755C5293E37DD00806B32 /* Diffusion.app */,
EBE755D6293E37DE00806B32 /* DiffusionTests.xctest */,
EBE755E0293E37DE00806B32 /* DiffusionUITests.xctest */,
F15520212971093300DC009B /* Diffusion-macOS.app */,
);
name = Products;
sourceTree = "<group>";
@ -190,6 +216,28 @@
path = Views;
sourceTree = "<group>";
};
F15520222971093300DC009B /* Diffusion-macOS */ = {
isa = PBXGroup;
children = (
F15520232971093300DC009B /* Diffusion_macOSApp.swift */,
F15520252971093300DC009B /* ContentView.swift */,
F1552030297109C300DC009B /* PromptView.swift */,
F155203329710B3600DC009B /* StatusView.swift */,
F15520272971093400DC009B /* Assets.xcassets */,
F155202C2971093400DC009B /* Diffusion_macOS.entitlements */,
F15520292971093400DC009B /* Preview Content */,
);
path = "Diffusion-macOS";
sourceTree = "<group>";
};
F15520292971093400DC009B /* Preview Content */ = {
isa = PBXGroup;
children = (
F155202A2971093400DC009B /* Preview Assets.xcassets */,
);
path = "Preview Content";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@ -251,6 +299,26 @@
productReference = EBE755E0293E37DE00806B32 /* DiffusionUITests.xctest */;
productType = "com.apple.product-type.bundle.ui-testing";
};
F15520202971093300DC009B /* Diffusion-macOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = F155202F2971093400DC009B /* Build configuration list for PBXNativeTarget "Diffusion-macOS" */;
buildPhases = (
F155201D2971093300DC009B /* Sources */,
F155201E2971093300DC009B /* Frameworks */,
F155201F2971093300DC009B /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "Diffusion-macOS";
packageProductDependencies = (
F155203B297118E700DC009B /* CompactSlider */,
);
productName = "Diffusion-macOS";
productReference = F15520212971093300DC009B /* Diffusion-macOS.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@ -258,7 +326,7 @@
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastSwiftUpdateCheck = 1410;
LastSwiftUpdateCheck = 1420;
LastUpgradeCheck = 1410;
TargetAttributes = {
EBE755C4293E37DD00806B32 = {
@ -272,6 +340,9 @@
CreatedOnToolsVersion = 14.1;
TestTargetID = EBE755C4293E37DD00806B32;
};
F15520202971093300DC009B = {
CreatedOnToolsVersion = 14.2;
};
};
};
buildConfigurationList = EBE755C0293E37DD00806B32 /* Build configuration list for PBXProject "Diffusion" */;
@ -287,6 +358,7 @@
EBB5BA5629425E17003A2A5B /* XCRemoteSwiftPackageReference "Path.swift" */,
EBB5BA5B294504DE003A2A5B /* XCRemoteSwiftPackageReference "ZIPFoundation" */,
EB33A51B2954D89F00B16357 /* XCRemoteSwiftPackageReference "ml-stable-diffusion" */,
F155203A297118E600DC009B /* XCRemoteSwiftPackageReference "CompactSlider" */,
);
productRefGroup = EBE755C6293E37DD00806B32 /* Products */;
projectDirPath = "";
@ -295,6 +367,7 @@
EBE755C4293E37DD00806B32 /* Diffusion */,
EBE755D5293E37DE00806B32 /* DiffusionTests */,
EBE755DF293E37DE00806B32 /* DiffusionUITests */,
F15520202971093300DC009B /* Diffusion-macOS */,
);
};
/* End PBXProject section */
@ -323,6 +396,16 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
F155201F2971093300DC009B /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F155202B2971093400DC009B /* Preview Assets.xcassets in Resources */,
F155203229710A1300DC009B /* Assets.xcassets in Resources */,
F15520282971093400DC009B /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@ -357,6 +440,17 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
F155201D2971093300DC009B /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F15520262971093300DC009B /* ContentView.swift in Sources */,
F1552031297109C300DC009B /* PromptView.swift in Sources */,
F155203429710B3600DC009B /* StatusView.swift in Sources */,
F15520242971093300DC009B /* Diffusion_macOSApp.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
@ -654,6 +748,60 @@
};
name = Release;
};
F155202D2971093400DC009B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "Diffusion-macOS/Diffusion_macOS.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"Diffusion-macOS/Preview Content\"";
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 13.1;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.cyrilzakka.Diffusion-macOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
F155202E2971093400DC009B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = "Diffusion-macOS/Diffusion_macOS.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"Diffusion-macOS/Preview Content\"";
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 13.1;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.cyrilzakka.Diffusion-macOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = macosx;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@ -693,6 +841,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
F155202F2971093400DC009B /* Build configuration list for PBXNativeTarget "Diffusion-macOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F155202D2971093400DC009B /* Debug */,
F155202E2971093400DC009B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
/* Begin XCRemoteSwiftPackageReference section */
@ -720,6 +877,14 @@
minimumVersion = 0.9.9;
};
};
F155203A297118E600DC009B /* XCRemoteSwiftPackageReference "CompactSlider" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/buh/CompactSlider.git";
requirement = {
branch = main;
kind = branch;
};
};
/* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
@ -738,6 +903,11 @@
package = EBB5BA5B294504DE003A2A5B /* XCRemoteSwiftPackageReference "ZIPFoundation" */;
productName = ZIPFoundation;
};
F155203B297118E700DC009B /* CompactSlider */ = {
isa = XCSwiftPackageProductDependency;
package = F155203A297118E600DC009B /* XCRemoteSwiftPackageReference "CompactSlider" */;
productName = CompactSlider;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = EBE755BD293E37DD00806B32 /* Project object */;

@ -0,0 +1,50 @@
{
"pins" : [
{
"identity" : "compactslider",
"kind" : "remoteSourceControl",
"location" : "https://github.com/buh/CompactSlider.git",
"state" : {
"branch" : "main",
"revision" : "3cb37fb7385913835b6844c6af2680c64000dcd2"
}
},
{
"identity" : "ml-stable-diffusion",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/ml-stable-diffusion",
"state" : {
"branch" : "main",
"revision" : "fb1fa01c9d30e9b2e02a8b7ed35d905e272a0262"
}
},
{
"identity" : "path.swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/mxcl/Path.swift.git",
"state" : {
"revision" : "9c6f807b0a76be0e27aecc908bc6f173400d839e",
"version" : "1.4.0"
}
},
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser.git",
"state" : {
"revision" : "fddd1c00396eed152c45a46bea9f47b98e59301d",
"version" : "1.2.0"
}
},
{
"identity" : "zipfoundation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/weichsel/ZIPFoundation.git",
"state" : {
"revision" : "43ec568034b3731101dbf7670765d671c30f54f3",
"version" : "0.9.16"
}
}
],
"version" : 2
}

@ -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>SchemeUserState</key>
<dict>
<key>Diffusion-macOS.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
</dict>
<key>Diffusion.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
Loading…
Cancel
Save