Skip to content

Commit

Permalink
Initial commit 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
focux committed Apr 5, 2021
1 parent 28eaeab commit 6d72b96
Show file tree
Hide file tree
Showing 22 changed files with 401 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

xcuserdata
project.xcworkspace
Carthage/Checkouts
Carthage/Build
Release
55 changes: 54 additions & 1 deletion AutoClicker.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 52;
objects = {

/* Begin PBXBuildFile section */
B10801EC26180977003E098E /* VisualEffectBlur.swift in Sources */ = {isa = PBXBuildFile; fileRef = B10801EB26180977003E098E /* VisualEffectBlur.swift */; };
B1080200261A33ED003E098E /* KeyboardShortcuts in Frameworks */ = {isa = PBXBuildFile; productRef = B10801FF261A33ED003E098E /* KeyboardShortcuts */; };
B1080206261A3521003E098E /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1080205261A3521003E098E /* Constants.swift */; };
B108020C261A38B8003E098E /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B108020B261A38B8003E098E /* SettingsView.swift */; };
B1080212261A3957003E098E /* GeneralSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1080211261A3957003E098E /* GeneralSettingsView.swift */; };
B173F36F260CAEE100717643 /* Tests_iOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = B173F36E260CAEE100717643 /* Tests_iOS.swift */; };
B173F37A260CAEE100717643 /* Tests_macOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = B173F379260CAEE100717643 /* Tests_macOS.swift */; };
B173F37C260CAEE100717643 /* AutoClickerApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = B173F353260CAEDE00717643 /* AutoClickerApp.swift */; };
Expand All @@ -15,6 +20,9 @@
B173F37F260CAEE100717643 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B173F354260CAEDE00717643 /* ContentView.swift */; };
B173F380260CAEE100717643 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B173F355260CAEE100717643 /* Assets.xcassets */; };
B173F381260CAEE100717643 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B173F355260CAEE100717643 /* Assets.xcassets */; };
B173F39C260D5C6800717643 /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B173F39B260D5C6800717643 /* HomeView.swift */; };
B173F39D260D5C6800717643 /* HomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B173F39B260D5C6800717643 /* HomeView.swift */; };
B1FD016B261A54C000690375 /* AppState.swift in Sources */ = {isa = PBXBuildFile; fileRef = B1FD016A261A54C000690375 /* AppState.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -35,6 +43,10 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
B10801EB26180977003E098E /* VisualEffectBlur.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VisualEffectBlur.swift; sourceTree = "<group>"; };
B1080205261A3521003E098E /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = "<group>"; };
B108020B261A38B8003E098E /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = "<group>"; };
B1080211261A3957003E098E /* GeneralSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralSettingsView.swift; sourceTree = "<group>"; };
B173F353260CAEDE00717643 /* AutoClickerApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AutoClickerApp.swift; sourceTree = "<group>"; };
B173F354260CAEDE00717643 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
B173F355260CAEE100717643 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
Expand All @@ -49,6 +61,8 @@
B173F375260CAEE100717643 /* Tests macOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Tests macOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
B173F379260CAEE100717643 /* Tests_macOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests_macOS.swift; sourceTree = "<group>"; };
B173F37B260CAEE100717643 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
B173F39B260D5C6800717643 /* HomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeView.swift; sourceTree = "<group>"; };
B1FD016A261A54C000690375 /* AppState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppState.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -63,6 +77,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B1080200261A33ED003E098E /* KeyboardShortcuts in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -101,6 +116,11 @@
B173F353260CAEDE00717643 /* AutoClickerApp.swift */,
B173F354260CAEDE00717643 /* ContentView.swift */,
B173F355260CAEE100717643 /* Assets.xcassets */,
B108020B261A38B8003E098E /* SettingsView.swift */,
B1080211261A3957003E098E /* GeneralSettingsView.swift */,
B1FD016A261A54C000690375 /* AppState.swift */,
B173F39B260D5C6800717643 /* HomeView.swift */,
B1080205261A3521003E098E /* Constants.swift */,
);
path = Shared;
sourceTree = "<group>";
Expand Down Expand Up @@ -128,6 +148,7 @@
isa = PBXGroup;
children = (
B173F364260CAEE100717643 /* Info.plist */,
B10801EB26180977003E098E /* VisualEffectBlur.swift */,
B173F365260CAEE100717643 /* macOS.entitlements */,
);
path = macOS;
Expand Down Expand Up @@ -184,6 +205,9 @@
dependencies = (
);
name = "AutoClicker (macOS)";
packageProductDependencies = (
B10801FF261A33ED003E098E /* KeyboardShortcuts */,
);
productName = "AutoClicker (macOS)";
productReference = B173F362260CAEE100717643 /* AutoClicker.app */;
productType = "com.apple.product-type.application";
Expand Down Expand Up @@ -258,6 +282,9 @@
Base,
);
mainGroup = B173F34D260CAEDE00717643;
packageReferences = (
B10801FE261A33ED003E098E /* XCRemoteSwiftPackageReference "KeyboardShortcuts" */,
);
productRefGroup = B173F35B260CAEE100717643 /* Products */;
projectDirPath = "";
projectRoot = "";
Expand Down Expand Up @@ -308,6 +335,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B173F39C260D5C6800717643 /* HomeView.swift in Sources */,
B173F37E260CAEE100717643 /* ContentView.swift in Sources */,
B173F37C260CAEE100717643 /* AutoClickerApp.swift in Sources */,
);
Expand All @@ -317,8 +345,14 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B108020C261A38B8003E098E /* SettingsView.swift in Sources */,
B10801EC26180977003E098E /* VisualEffectBlur.swift in Sources */,
B173F39D260D5C6800717643 /* HomeView.swift in Sources */,
B1FD016B261A54C000690375 /* AppState.swift in Sources */,
B173F37F260CAEE100717643 /* ContentView.swift in Sources */,
B173F37D260CAEE100717643 /* AutoClickerApp.swift in Sources */,
B1080212261A3957003E098E /* GeneralSettingsView.swift in Sources */,
B1080206261A3521003E098E /* Constants.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -696,6 +730,25 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
B10801FE261A33ED003E098E /* XCRemoteSwiftPackageReference "KeyboardShortcuts" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/sindresorhus/KeyboardShortcuts";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.0.0;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
B10801FF261A33ED003E098E /* KeyboardShortcuts */ = {
isa = XCSwiftPackageProductDependency;
package = B10801FE261A33ED003E098E /* XCRemoteSwiftPackageReference "KeyboardShortcuts" */;
productName = KeyboardShortcuts;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = B173F34E260CAEDE00717643 /* Project object */;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<key>AutoClicker (iOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
<key>AutoClicker (macOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>
Expand Down
16 changes: 16 additions & 0 deletions Shared/AppState.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// AppState.swift
// AutoClicker (macOS)
//
// Created by Leonardo Dominguez on 4/4/21.
//
import Foundation
import KeyboardShortcuts

class AppState: ObservableObject {
@Published var shortcut: KeyboardShortcuts.Shortcut?

init() {
shortcut = KeyboardShortcuts.getShortcut(for: .toggleAutoClick)
}
}
10 changes: 10 additions & 0 deletions Shared/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,51 +91,61 @@
"size" : "1024x1024"
},
{
"filename" : "Icon-16.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"filename" : "Icon-33.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"filename" : "Icon-32.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"filename" : "Icon-64.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"filename" : "Icon-128.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"filename" : "Icon-257.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"filename" : "Icon-256.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"filename" : "Icon-512.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"filename" : "playstore.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"filename" : "Icon-1024.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 10 additions & 1 deletion Shared/AutoClickerApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@
//

import SwiftUI
import KeyboardShortcuts

@main
struct AutoClickerApp: App {
@StateObject var appState: AppState = AppState()

var body: some Scene {
WindowGroup {
ContentView()
ContentView().environmentObject(appState)
}
.windowToolbarStyle(UnifiedCompactWindowToolbarStyle())
.windowStyle(HiddenTitleBarWindowStyle())
Settings {
SettingsView().environmentObject(appState)

}
}
}
12 changes: 12 additions & 0 deletions Shared/Constants.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// Constants.swift
// AutoClicker (macOS)
//
// Created by Leonardo Dominguez on 4/4/21.
//

import KeyboardShortcuts

extension KeyboardShortcuts.Name {
static let toggleAutoClick = Self("toggleAutoClick",default: .init(.k, modifiers: [.command]))
}
20 changes: 18 additions & 2 deletions Shared/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,24 @@ import SwiftUI

struct ContentView: View {
var body: some View {
Text("Hello, world!")
.padding()
HomeView()
.frame(minWidth: 300, minHeight: 300)
.navigationTitle("Auto Clicker")
.toolbar(content: {
ToolbarItemGroup(placement: .automatic) {
Spacer()
Menu {
Button(action: {
NSApp.sendAction(Selector(("showPreferencesWindow:")), to: nil, from: nil)
}) {
Label("Preferences", systemImage: "gear")
}
} label: {
Label("Options", systemImage: "ellipsis.circle.fill")
}
}
})

}
}

Expand Down
46 changes: 46 additions & 0 deletions Shared/GeneralSettingsView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// GeneralSettingsView.swift
// AutoClicker (macOS)
//
// Created by Leonardo Dominguez on 4/4/21.
//

import SwiftUI
import KeyboardShortcuts

struct GeneralSettingsView: View {
@AppStorage("showPreview") private var showPreview = true
@AppStorage("secondsInterval") private var secondsInterval = 1.0
@AppStorage("playSound") private var playSound = true
@AppStorage("clicksPerSecond") private var clicksPerSecond = 1.0
@EnvironmentObject var appState: AppState

var body: some View {
Form {
VStack(alignment: .leading, spacing: 15) {
HStack {
Text("Shorcut:")
KeyboardShortcuts.Recorder(for: .toggleAutoClick, onChange: { newShortcut in
appState.shortcut = newShortcut
})
}
Toggle("Play sound when clicking", isOn: $playSound)
Slider(value: $secondsInterval, in: 1...30, step: 1) {
Text("Seconds Interval (\(secondsInterval, specifier: "%.0f")s)")
.frame(width: 145, alignment: .leading)
}
Slider(value: $clicksPerSecond, in: 1...20, step: 1) {
Text("Clicks per second (\(clicksPerSecond, specifier: "%.0f"))")
.frame(width: 145, alignment: .leading)
}
}
.padding()
}
}
}

struct GeneralSettingsView_Previews: PreviewProvider {
static var previews: some View {
GeneralSettingsView().frame(width: 350, height: 200)
}
}
Loading

0 comments on commit 6d72b96

Please sign in to comment.