Skip to content

Commit

Permalink
Merge pull request #2 from hiddenviewer/develop
Browse files Browse the repository at this point in the history
release pr project Xcode9.3 and Swift4.1 release
  • Loading branch information
hiddenviewer authored Jun 17, 2018
2 parents 095c51a + a2cd361 commit a6a2bb8
Show file tree
Hide file tree
Showing 13 changed files with 115 additions and 46 deletions.
50 changes: 37 additions & 13 deletions Swiftris.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -244,17 +244,17 @@
attributes = {
LastSwiftMigration = 0710;
LastSwiftUpdateCheck = 0710;
LastUpgradeCheck = 0820;
LastUpgradeCheck = 0930;
ORGANIZATIONNAME = 1minute2life;
TargetAttributes = {
D0C634401B463ACD003D48F1 = {
CreatedOnToolsVersion = 6.4;
DevelopmentTeam = J577953YGJ;
LastSwiftMigration = 0820;
LastSwiftMigration = 0930;
};
D0C634551B463ACD003D48F1 = {
CreatedOnToolsVersion = 6.4;
LastSwiftMigration = 0820;
LastSwiftMigration = 0930;
TestTargetID = D0C634401B463ACD003D48F1;
};
};
Expand Down Expand Up @@ -368,14 +368,22 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -415,14 +423,22 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -454,13 +470,16 @@
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: sungbae kim (6B27A3XEV5)";
DEVELOPMENT_TEAM = J577953YGJ;
INFOPLIST_FILE = Swiftris/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "net.1minute2life.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = net.1minute2life.Swiftriss;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "71330c25-20ff-4296-b0e7-42e60de6566f";
SWIFT_VERSION = 3.0;
PROVISIONING_PROFILE = "9cea494c-f058-4ce1-b9fc-7d24bf87f212";
PROVISIONING_PROFILE_SPECIFIER = DEV_WILDCARD_ProvisioningProfiles;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Debug;
Expand All @@ -472,13 +491,16 @@
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = J577953YGJ;
INFOPLIST_FILE = Swiftris/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "net.1minute2life.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = net.1minute2life.Swiftriss;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
SWIFT_VERSION = 3.0;
PROVISIONING_PROFILE = "9cea494c-f058-4ce1-b9fc-7d24bf87f212";
PROVISIONING_PROFILE_SPECIFIER = DEV_WILDCARD_ProvisioningProfiles;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 1;
};
name = Release;
Expand All @@ -496,7 +518,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "net.1minute2life.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Swiftris.app/Swiftris";
};
name = Debug;
Expand All @@ -510,7 +533,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "net.1minute2life.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Swiftris.app/Swiftris";
};
name = Release;
Expand Down
15 changes: 10 additions & 5 deletions Swiftris/Base.lproj/LaunchScreen.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D131" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
Expand All @@ -14,11 +19,11 @@
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Swiftris" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="kId-c2-rCX">
<rect key="frame" x="20" y="140" width="441" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" red="0.27000000000000002" green="0.27000000000000002" blue="0.27000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="kId-c2-rCX" firstAttribute="centerY" secondItem="iN0-l3-epB" secondAttribute="bottom" multiplier="1/3" constant="1" id="5cJ-9S-tgC"/>
<constraint firstAttribute="centerX" secondItem="kId-c2-rCX" secondAttribute="centerX" id="Koa-jz-hwk"/>
Expand Down
35 changes: 26 additions & 9 deletions Swiftris/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,23 +1,40 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="vXZ-lx-hvc">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--Swiftris View Controller-->
<scene sceneID="ufC-wZ-h7g">
<objects>
<viewController id="vXZ-lx-hvc" customClass="SwiftrisViewController" customModule="Swiftris" customModuleProvider="target" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/>
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="w3W-aq-aeh" userLabel="ContentView">
<rect key="frame" x="0.0" y="20" width="375" height="647"/>
<color key="backgroundColor" red="0.27000000000000002" green="0.27000000000000002" blue="0.27000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</view>
</subviews>
<color key="backgroundColor" red="0.27000000000000002" green="0.27000000000000002" blue="0.27000000000000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="UHi-3b-vel" firstAttribute="bottom" secondItem="w3W-aq-aeh" secondAttribute="bottom" id="KGP-o3-VIl"/>
<constraint firstItem="w3W-aq-aeh" firstAttribute="leading" secondItem="UHi-3b-vel" secondAttribute="leading" id="Xxm-tf-e1P"/>
<constraint firstItem="w3W-aq-aeh" firstAttribute="top" secondItem="UHi-3b-vel" secondAttribute="top" id="cmD-kD-gsf"/>
<constraint firstItem="UHi-3b-vel" firstAttribute="trailing" secondItem="w3W-aq-aeh" secondAttribute="trailing" id="wRl-Hs-d6C"/>
</constraints>
<viewLayoutGuide key="safeArea" id="UHi-3b-vel"/>
</view>
<connections>
<outlet property="contentView" destination="w3W-aq-aeh" id="eaS-8b-bbR"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
Expand Down
2 changes: 1 addition & 1 deletion Swiftris/Game/Model/GameTimer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class GameTimer: NSObject {

init(target:AnyObject, selector:Selector) {
self.displayLink = CADisplayLink(target: target, selector: selector)
self.displayLink.frameInterval = 2
self.displayLink.preferredFramesPerSecond = 30
self.displayLink.isPaused = true
self.displayLink.add(to: RunLoop.current, forMode: RunLoopMode.defaultRunLoopMode)
}
Expand Down
8 changes: 4 additions & 4 deletions Swiftris/Game/Swiftris.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Swiftris: NSObject {
self.gameView = nil
}

func gameStateChange(_ noti:Notification) {
@objc func gameStateChange(_ noti:Notification) {
guard let userInfo = noti.userInfo as? [String:NSNumber] else { return }
guard let rawValue = userInfo["gameState"] else { return }
guard let toState = GameState(rawValue: rawValue.intValue) else { return }
Expand Down Expand Up @@ -95,15 +95,15 @@ class Swiftris: NSObject {
}


func longPressed(_ longpressGesture:UILongPressGestureRecognizer) {
@objc func longPressed(_ longpressGesture:UILongPressGestureRecognizer) {
if self.gameState == GameState.play {
if longpressGesture.state == UIGestureRecognizerState.began {
self.gameView.gameBoard.dropBrick()
}
}
}

func gameLoop() {
@objc func gameLoop() {
self.update()
self.gameView.setNeedsDisplay()
}
Expand Down Expand Up @@ -170,7 +170,7 @@ class Swiftris: NSObject {
}
}

func rotateBrick() {
@objc func rotateBrick() {
guard self.gameState == GameState.play else { return }
guard let _ = self.gameView.gameBoard.currentBrick else { return }

Expand Down
13 changes: 9 additions & 4 deletions Swiftris/Game/SwiftrisViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
// SwiftrisViewController.swift
// Swiftris
//
// Created by 김성배 on 2016. 6. 4..
// Created by Sungbae Kim on 2016. 6. 4..
// Copyright © 2016년 1minute2life. All rights reserved.
//

import UIKit

class SwiftrisViewController: UIViewController {

@IBOutlet weak var contentView: UIView!

var swiftris:Swiftris!

override func viewDidLoad() {
super.viewDidLoad()
self.initializeGame()
Expand All @@ -26,8 +28,11 @@ class SwiftrisViewController: UIViewController {
}

func initializeGame() {
let gameView = GameView(self.view)
self.swiftris = Swiftris(gameView: gameView)
// after layout pass, ensure GameView to make
DispatchQueue.main.async {
let gameView = GameView(self.contentView)
self.swiftris = Swiftris(gameView: gameView)
}
}

override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
Expand Down
2 changes: 1 addition & 1 deletion Swiftris/Game/View/GameButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// GameButton.swift
// Swiftris
//
// Created by 김성배 on 2016. 6. 12..
// Created by Sungbae Kim on 2016. 6. 12..
// Copyright © 2016년 1minute2life. All rights reserved.
//

Expand Down
2 changes: 1 addition & 1 deletion Swiftris/Game/View/GameScore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class GameScore: UIView {
object: nil)
}

func lineClear(_ noti:Notification) {
@objc func lineClear(_ noti:Notification) {
if let userInfo = noti.userInfo as? [String:NSNumber] {
if let lineCount = userInfo["lineCount"] {
self.lineClearCount += lineCount.intValue
Expand Down
6 changes: 3 additions & 3 deletions Swiftris/Game/View/GameView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class GameView: UIView {
var rotateButton = GameButton(title: "R", frame: CGRect.zero)

init(_ superView:UIView) {
super.init(frame: superView.frame)
super.init(frame: superView.bounds)
superView.backgroundColor = UIColor(red:0.27, green:0.27, blue:0.27, alpha:1.0)
superView.addSubview(self)

Expand Down Expand Up @@ -75,9 +75,9 @@ class GameView: UIView {

self.addConstraints(
NSLayoutConstraint.constraints(
withVisualFormat: "V:|-20-[gameScore]-[gameBoard]",
withVisualFormat: "V:|-[gameScore]-[gameBoard]",
options: [],
metrics:nil ,
metrics:metrics ,
views:views)
)

Expand Down
6 changes: 3 additions & 3 deletions Swiftris/Game/View/NextBrick.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class NextBrick: UIView {
NotificationCenter.default.removeObserver(self)
}

func newBrickGenerated() {
@objc func newBrickGenerated() {
self.setNeedsDisplay()
}

Expand Down Expand Up @@ -126,15 +126,15 @@ class NextBrick: UIView {
)
}

func gameStop(_ sender:UIButton) {
@objc func gameStop(_ sender:UIButton) {
NotificationCenter.default.post(
name: Notification.Name(rawValue: Swiftris.GameStateChangeNotification),
object: nil,
userInfo: ["gameState":NSNumber(value: GameState.stop.rawValue as Int)]
)
}

func changeGameState(_ sender:UIButton) {
@objc func changeGameState(_ sender:UIButton) {
sender.isSelected = !sender.isSelected
let gameState = self.update(sender.isSelected)

Expand Down
16 changes: 16 additions & 0 deletions Swiftris/Images.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
Expand Down Expand Up @@ -31,6 +41,12 @@
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "3x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "swiftris1024.jpg",
"scale" : "1x"
}
],
"info" : {
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

0 comments on commit a6a2bb8

Please sign in to comment.