Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesliu committed Aug 5, 2018
1 parent b661fed commit ac0577a
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 74 deletions.
78 changes: 78 additions & 0 deletions .gitignore
@@ -0,0 +1,78 @@

# Created by https://www.gitignore.io/api/swift

### Swift ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData/

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/

## Other
*.moved-aside
*.xccheckout
*.xcscmblueprint

## Obj-C/Swift specific
*.hmap
*.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
.build/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
#
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/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


# End of https://www.gitignore.io/api/swift
30 changes: 22 additions & 8 deletions literary-screensaver.xcodeproj/project.pbxproj
Expand Up @@ -7,15 +7,13 @@
objects = {

/* Begin PBXBuildFile section */
AE7CF26F2116705C008A6BE0 /* literary_screensaverView.h in Headers */ = {isa = PBXBuildFile; fileRef = AE7CF26E2116705C008A6BE0 /* literary_screensaverView.h */; };
AE7CF2712116705C008A6BE0 /* literary_screensaverView.m in Sources */ = {isa = PBXBuildFile; fileRef = AE7CF2702116705C008A6BE0 /* literary_screensaverView.m */; };
AE7CF27921167143008A6BE0 /* SwiftSS.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7CF27821167143008A6BE0 /* SwiftSS.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
AE7CF26B2116705C008A6BE0 /* literary-screensaver.saver */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "literary-screensaver.saver"; sourceTree = BUILT_PRODUCTS_DIR; };
AE7CF26E2116705C008A6BE0 /* literary_screensaverView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = literary_screensaverView.h; sourceTree = "<group>"; };
AE7CF2702116705C008A6BE0 /* literary_screensaverView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = literary_screensaverView.m; sourceTree = "<group>"; };
AE7CF2722116705C008A6BE0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
AE7CF27821167143008A6BE0 /* SwiftSS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftSS.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -48,8 +46,7 @@
AE7CF26D2116705C008A6BE0 /* literary-screensaver */ = {
isa = PBXGroup;
children = (
AE7CF26E2116705C008A6BE0 /* literary_screensaverView.h */,
AE7CF2702116705C008A6BE0 /* literary_screensaverView.m */,
AE7CF27821167143008A6BE0 /* SwiftSS.swift */,
AE7CF2722116705C008A6BE0 /* Info.plist */,
);
path = "literary-screensaver";
Expand All @@ -62,7 +59,6 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
AE7CF26F2116705C008A6BE0 /* literary_screensaverView.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -98,6 +94,7 @@
TargetAttributes = {
AE7CF26A2116705C008A6BE0 = {
CreatedOnToolsVersion = 9.4.1;
LastSwiftMigration = 0940;
};
};
};
Expand Down Expand Up @@ -133,7 +130,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
AE7CF2712116705C008A6BE0 /* literary_screensaverView.m in Sources */,
AE7CF27921167143008A6BE0 /* SwiftSS.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -252,27 +249,44 @@
AE7CF2762116705C008A6BE0 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = 5WFUXN96S7;
INFOPLIST_FILE = "literary-screensaver/Info.plist";
INSTALL_PATH = "$(HOME)/Library/Screen Savers";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "io.jamesliu.literary-screensaver";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
WRAPPER_EXTENSION = saver;
};
name = Debug;
};
AE7CF2772116705C008A6BE0 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = 5WFUXN96S7;
INFOPLIST_FILE = "literary-screensaver/Info.plist";
INSTALL_PATH = "$(HOME)/Library/Screen Savers";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "io.jamesliu.literary-screensaver";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
WRAPPER_EXTENSION = saver;
};
name = Release;
Expand Down
2 changes: 1 addition & 1 deletion literary-screensaver/Info.plist
Expand Up @@ -21,6 +21,6 @@
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2018 James Liu. All rights reserved.</string>
<key>NSPrincipalClass</key>
<string>literary_screensaverView</string>
<string>SwiftSS</string>
</dict>
</plist>
43 changes: 43 additions & 0 deletions literary-screensaver/SwiftSS.swift
@@ -0,0 +1,43 @@
//
// SwiftSS.swift
// literary-screensaver
//
// Created by James Liu on 5/8/18.
// Copyright © 2018 James Liu. All rights reserved.
//

import ScreenSaver

class SwiftSS: ScreenSaverView {

var timer = Timer()
var currentTime: String = ""

override func startAnimation() {
super.startAnimation()
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(self.updateTime), userInfo: nil, repeats: true)
}

override func animateOneFrame() {
currentTime.draw(at: NSPoint(x: 100.0, y: 200.0), withAttributes: nil)
}

func updateTime() {
let date = Date()
let formatter = DateFormatter()
formatter.dateFormat = "HH:mm:ss"

currentTime = formatter.string(from: date)
}

override func draw(_ rect: NSRect) {
super.draw(rect)

NSColor.red.setFill()

NSRectFill(self.bounds)
NSColor.black.set()

currentTime.draw(at: NSPoint(x: 100.0, y: 200.0), withAttributes: nil)
}
}
13 changes: 0 additions & 13 deletions literary-screensaver/literary_screensaverView.h

This file was deleted.

52 changes: 0 additions & 52 deletions literary-screensaver/literary_screensaverView.m

This file was deleted.

0 comments on commit ac0577a

Please sign in to comment.