2048 for Swift

Overview

swift-2048

A working port of iOS-2048 to Apple's new Swift language.

Like the original Objective-C version, swift-2048 does not rely upon SpriteKit. See the description for iOS-2048 for more information.

I'm not actively working on this, except to fix bugs and maintain compatibility with latest versions. Pull requests are welcome, though. Note that Swift was very different back when I first wrote this code, caveat emptor.

If you want to check out a more advanced Swift project, please take a look at Lambdatron, my Clojure interpreter.

Instructions

You will need Xcode 7 to run the project. Run it in the simulator or on an actual device.

Tap the button to play the game. Swipe to move the tiles.

Thoughts on Swift

Swift is a well-designed language that will, hopefully, drag mainstream programming halfway to ML (kicking and screaming the entire way, of course).

If you really want to see my out-of-date thoughts on Swift, check out the git history for README.md.

License

(c) 2014-2015 Austin Zheng. Released under the terms of the MIT license.

2048 by Gabriele Cirulli (http://gabrielecirulli.com/). The original game can be found at http://gabrielecirulli.github.io/2048/, as can all relevant attributions. 2048 is inspired by an iOS game called "Threes", by Asher Vollmer.

Comments
  • Question regarding licensing

    Question regarding licensing

    The source code states that all rights are reserved, which to me means closed-source, but the LICENSE file says that this is under MIT. Just for clarification, which license, if any, is being used?

    opened by flaw600 4
  • Spiced up the UI and corrected score logic

    Spiced up the UI and corrected score logic

    Awesome work on the initial implementation! I wanted to play around with Swift so I made a few improvements to the project.

    • UI
    • Fixed UIAlert Bug
    • User now get directed to the main screen after game ends
    • Scoring
    • Best Score
    opened by RyanBertrand 3
  • UIAlertView

    UIAlertView

    I noticed here that you have commented out UIAlertView. You can still create UIAlertViews by using an empty constructor and setting all the fields in the init method manually.

    Just wanted to let you know!

    opened by smswz 1
  • Migrate to Swift 3

    Migrate to Swift 3

    Migrate to Swift 3.

    Most changes were performed by Xcode's conversion tools; I also changed some function prototypes to follow the latest style guidelines.

    opened by PumpMagic 0
  • Build fixes for Xcode6-Beta7 on OS X 10.9.4

    Build fixes for Xcode6-Beta7 on OS X 10.9.4

    I just removed 'value: ' in the spots that the debugger was telling me. This allowed me to successfully build and play the game. The first commit changed the tab indentation so I made a second commit to match the original file's indentations.

    opened by Jlong33 0
  • Recommendation for iOS 13 and more

    Recommendation for iOS 13 and more

    Apple introduced a new default card presentation. And vertical scroll is not working because it scroll cardview. In order to force the fullscreen you have to add in the file NumberTileGame.swift -> end of init() line 45 -> add next code:

    self.modalPresentationStyle = .fullScreen

    opened by bpatapb88 0
Owner
Austin Zheng
I do things with computers.
Austin Zheng
Swift Library based on AVFoundation that allow to easily add camera feature with custom UI into your project.

Would you like to create your camera same as Snapchat or Instagram? I think this library could help you. Basicly it is a wrapper above AVFoundation th

Taras Chernyshenko 14 Sep 21, 2022
Fully open source text editor for iOS written in Swift.

Edhita Fully open source text editor for iOS written in Swift. http://edhita.bornneet.com/ What Edhita means? Edhita (Romaji) == エディタ (Katakana) == Ed

Tatsuya Tobioka 1.2k Jan 7, 2023
30 mini Swift Apps for self-study

Swift 30 Projects Contents This repo is updated with Swift 5 and compatible with iPhone X: Simple UIKit components UIScrollView, UITableView, UICollec

Soap 7.5k Jan 3, 2023
A Hacker News reader in Swift

SwiftHN A Hacker News reader in Swift using the best features of both the language and iOS 8 latest API (well, that's the end goal) SwiftHN is now ava

Thomas Ricouard 1.7k Dec 24, 2022
Build a Swift App as a designer

DesignerNewsApp Simple iOS client for Designer News, by the creator of Design+Code and the team, written in Swift. Usage Download the repository $ git

Meng To 2.4k Dec 24, 2022
swift implementation of flappy bird. More at fullstackedu.com

FlappySwift An implementation of Flappy Bird in Swift for iOS 8. Notes We're launching a course Game Programming with Swift If you are interested in e

newline (formerly Fullstack.io) 9.5k Dec 29, 2022
Basic app to show how to login with Facebook, Google, Twitter. Created for learning purpose :) using Xcode 9 and Swift 4.0

Social Logins iOS Basic app to show how to login with Facebook, Google, Twitter. Created for learning purpose :) using Xcode 9 and Swift 4.0 Note: Bef

Jogendra 12 Nov 4, 2022
Applozic UI Kit in Swift

Official iOS Swift SDK for Chat ?? Introduction ?? Applozic brings real-time engagement with chat, video, and voice to your web, mobile, and conversat

Applozic 50 Mar 21, 2022
Simple sample of using the VIP (Clean Swift) architecture for iOS

MyAnimeList Simple sample of using the VIP (Clean Swift) architecture for iOS. ViewController: controls the event handling, view life cycle and displa

null 24 Oct 12, 2022
Swift audio synthesis, processing, & analysis platform for iOS, macOS and tvOS

AudioKit AudioKit is an audio synthesis, processing, and analysis platform for iOS, macOS (including Catalyst), and tvOS. Installation To add AudioKit

AudioKit 9.5k Jan 5, 2023
A Swift mailing list client for iPhone and iPad

Due to costs and lack of interest, I’ve had to take down the Charter service. If you’re interested in running your own copy, get in touch and I can se

Matthew Palmer 526 Dec 24, 2022
Learn Swift interactively on your iPhone.

Unwrap is an app that helps you learn Swift faster and more effectively. At its core lies almost 100 video lessons that teach all the fundamentals of

Paul Hudson 2.1k Dec 29, 2022
▶️ video player in Swift, simple way to play and stream media on iOS/tvOS

Player Player is a simple iOS video player library written in Swift. Looking for an obj-c video player? Check out PBJVideoPlayer (obj-c). Looking for

patrick piemonte 2k Dec 24, 2022
SushiMarketingApp - Sushi Marketing App Built With Swift

SushiMarketingApp Sushi E-Commerce App Language: Swift and Objective-C Database:

Serkan Kara 3 Apr 16, 2022
TwitchIRC - A Swift package for parsing/serializing Twitch IRC messages

TwitchIRC A Swift package to take of parsing/serializing Twitch IRC messages for

Mahdi Bahrami 8 Jan 3, 2023
2048 for Swift

swift-2048 A working port of iOS-2048 to Apple's new Swift language. Like the original Objective-C version, swift-2048 does not rely upon SpriteKit. S

Austin Zheng 3.1k Dec 24, 2022
2048 for Swift

swift-2048 A working port of iOS-2048 to Apple's new Swift language. Like the original Objective-C version, swift-2048 does not rely upon SpriteKit. S

Austin Zheng 3.1k Dec 27, 2022
A 2048 game writing with SwiftUI.

2048 Game (SwiftUI app) This is a simple game to demonstrate the new SwiftUI framework. Note that the game algorithm may have issues, and this is stil

Cyandev 643 Dec 26, 2022
iOS drop-in library presenting a 2048-style game

iOS-2048 iOS drop-in library presenting a clean-room Objective-C/Cocoa implementation of the game 2048. Screenshot Instructions The included sample ap

Austin Zheng 321 Dec 22, 2022
The iOS version of 2048, made using SpriteKit

2048 This is a derivative and the iOS version of the game 2048. In the very unlikely case that you don't know what it is, you can check it out here. M

Danqing Liu 1.1k Dec 31, 2022