Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Demo macOS migrated to SwiftUI 🚀
Browse files Browse the repository at this point in the history
chicio committed Oct 12, 2024
1 parent 80e4677 commit 385ed8b
Showing 14 changed files with 249 additions and 1,031 deletions.
21 changes: 0 additions & 21 deletions Demo/Demo macOS/AppDelegate.swift

This file was deleted.

11 changes: 11 additions & 0 deletions Demo/Demo macOS/Assets.xcassets/AccentColor.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions Demo/Demo macOS/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
751 changes: 0 additions & 751 deletions Demo/Demo macOS/Base.lproj/Main.storyboard

This file was deleted.

39 changes: 39 additions & 0 deletions Demo/Demo macOS/ContentView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
//
// ContentView.swift
// Demo macOS
//
// Created by Fabrizio Duroni on 12.10.2024.
// Copyright © 2024 Fabrizio Duroni. All rights reserved.
//

import SwiftUI
import ID3TagEditor

struct ContentView: View {
@State private var tag: ID3Tag?

var body: some View {
VStack {
if let validTag = tag {
if let data = (validTag.frames[.attachedPicture(.frontCover)] as? ID3FrameAttachedPicture)?.picture,
let validImage = NSImage(data: data) {
Image(nsImage: validImage)
.resizable()
.frame(width: 200, height: 200)
}
Text((validTag.frames[.title] as? ID3FrameWithStringContent)?.content ?? "")
Text((validTag.frames[.album] as? ID3FrameWithStringContent)?.content ?? "")
Text((validTag.frames[.genre] as? ID3FrameGenre)?.description ?? "")
}
}
.padding()
.onAppear {
let id3TagEditor = ID3TagEditor()
tag = try? id3TagEditor.read(from: PathLoader().pathFor(name: "example", fileType: "mp3"))!
}
}
}

#Preview {
ContentView()
}
Original file line number Diff line number Diff line change
@@ -2,9 +2,9 @@
<!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/>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
</dict>
</plist>
18 changes: 18 additions & 0 deletions Demo/Demo macOS/DemoMacOSApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// Demo_macOSApp.swift
// Demo macOS
//
// Created by Fabrizio Duroni on 12.10.2024.
// Copyright © 2024 Fabrizio Duroni. All rights reserved.
//

import SwiftUI

@main
struct Demo_macOSApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
32 changes: 0 additions & 32 deletions Demo/Demo macOS/Info.plist

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
44 changes: 0 additions & 44 deletions Demo/Demo macOS/ViewController.swift

This file was deleted.

Binary file modified Demo/Demo macOS/example.mp3
Binary file not shown.
305 changes: 150 additions & 155 deletions Demo/Demo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

25 changes: 8 additions & 17 deletions Demo/Demo.xcodeproj/xcshareddata/xcschemes/Demo macOS.xcscheme
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1600"
version = "1.3">
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
@@ -14,7 +15,7 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "452832EE2044D28E00458375"
BlueprintIdentifier = "45F60CFF2CBACAB80073BC12"
BuildableName = "Demo macOS.app"
BlueprintName = "Demo macOS"
ReferencedContainer = "container:Demo.xcodeproj">
@@ -26,18 +27,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "452832EE2044D28E00458375"
BuildableName = "Demo macOS.app"
BlueprintName = "Demo macOS"
ReferencedContainer = "container:Demo.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
</Testables>
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -53,7 +44,7 @@
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "452832EE2044D28E00458375"
BlueprintIdentifier = "45F60CFF2CBACAB80073BC12"
BuildableName = "Demo macOS.app"
BlueprintName = "Demo macOS"
ReferencedContainer = "container:Demo.xcodeproj">
@@ -70,7 +61,7 @@
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "452832EE2044D28E00458375"
BlueprintIdentifier = "45F60CFF2CBACAB80073BC12"
BuildableName = "Demo macOS.app"
BlueprintName = "Demo macOS"
ReferencedContainer = "container:Demo.xcodeproj">
14 changes: 7 additions & 7 deletions Demo/Demo.xcodeproj/xcshareddata/xcschemes/Demo watchOS.xcscheme
Original file line number Diff line number Diff line change
@@ -16,8 +16,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "45F78C242CB939C700AD985F"
BuildableName = "Demo watchOS Watch App.app"
BlueprintName = "Demo watchOS Watch App"
BuildableName = "Demo watchOS.app"
BlueprintName = "Demo watchOS"
ReferencedContainer = "container:Demo.xcodeproj">
</BuildableReference>
</BuildActionEntry>
@@ -29,7 +29,7 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "45F78C1F2CB939C700AD985F"
BlueprintIdentifier = "45F78C242CB939C700AD985F"
BuildableName = "Demo watchOS.app"
BlueprintName = "Demo watchOS"
ReferencedContainer = "container:Demo.xcodeproj">
@@ -59,8 +59,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "45F78C242CB939C700AD985F"
BuildableName = "Demo watchOS Watch App.app"
BlueprintName = "Demo watchOS Watch App"
BuildableName = "Demo watchOS.app"
BlueprintName = "Demo watchOS"
ReferencedContainer = "container:Demo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
@@ -76,8 +76,8 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "45F78C242CB939C700AD985F"
BuildableName = "Demo watchOS Watch App.app"
BlueprintName = "Demo watchOS Watch App"
BuildableName = "Demo watchOS.app"
BlueprintName = "Demo watchOS"
ReferencedContainer = "container:Demo.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>

0 comments on commit 385ed8b

Please sign in to comment.