Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    kitoko552
    @kitoko552
    hello
    yutaka juba
    @yutaka-j
    hello
    kitoko552
    @kitoko552
    ukkary
    @ukkary
    ping
    Hirotoki Sato
    @tokihiro000
    megane
    sambaiz
    @sambaiz
    println("hello world")
    Hirotoki Sato
    @tokihiro000
    nortification機能
    タグ機能
    ukkary
    @ukkary
    修論.死ぬ.jp
    Hirotoki Sato
    @tokihiro000
    修論.死ぬ.jp のように 終了時刻までカウントダウンする
    mogenerator -m ./SwiftTodo/SwiftTodo.xcdatamodeld/ -O ./Model/
    ukkary
    @ukkary
    こいつ、時間になったらbadge表示してくれるコード書いてる、やりたいことそのまんま!
    https://www.youtube.com/watch?v=Yh3lLpV1k_Y
    ukkary
    @ukkary
    @IBAction func limitCounter(){
    var testDate : NSDateComponents = NSDateComponents()
    testDate.year = 2014
    testDate.month = 07
    testDate.day = 26
    testDate.hour = 14
    testDate.minute = 00
    testDate.timeZone = NSTimeZone.systemTimeZone()
        let CurrentDate = NSDate()
        let CurrentDateFormatter = NSDateFormatter()
        //NSTimeInterval delta = [CurrentDate timeIntervalSinceDate,: testData]
    
    
        CurrentDateFormatter.locale = NSLocale(localeIdentifier: "UTF-8")
        CurrentDateFormatter.timeStyle = .MediumStyle
        CurrentDateFormatter.dateStyle = .NoStyle
    
        var timer = NSTimer.scheduledTimerWithTimeInterval(1, target:self, selector: Selector("limitCounter"), userInfo: nil, repeats: false)
        //limit.text =
    
    
        //println(CurrentDateFormatter.stringFromDate(CurrentDate))
    }
    func notif(){
        var dataComp : NSDateComponents = NSDateComponents()
        dataComp.year = 2014
        dataComp.month = 07
        dataComp.day = 26
        dataComp.hour = 14
        dataComp.minute = 11
        dataComp.timeZone = NSTimeZone.systemTimeZone()
    
        var calender : NSCalendar = NSCalendar(calendarIdentifier: NSGregorianCalendar)
    
        var date : NSDate = calender.dateFromComponents (dataComp)
    
        var notification : UILocalNotification = UILocalNotification()
        notification.category = "FIRST_CATEGORY"
        notification.alertBody = "aaa"
        //notification.alertBody = todoObjects[NSIndexPath! .indexPathForRow(1, inSection: 1)]
        notification.fireDate = date
    
        println(todoObjects)
        UIApplication.sharedApplication().scheduleLocalNotification(notification)
    }
    ukkary
    @ukkary
    NSTimeInterval since;
    // dateAとdateBの時間の間隔を取得(dateA - dateBなイメージ)
    since = [dateA timeIntervalSinceDate:dateB];
    NSLog(@"%f", since);
    NSLog(@"%f分", since/60);
    NSLog(@"%f", since/(60*60));
    NSLog(@"%f日", since/(24*60*60));
    Hirotoki Sato
    @tokihiro000

    //
    // ViewController.swift
    // SwiftTodo
    //
    // Created by 石井晃 on 2014/06/03.
    // Copyright (c) 2014年 exilias. All rights reserved.
    //

    import UIKit

    class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {

    var todoObjects = [];
    var indexPathForCell : NSIndexPath?
    var selectedCell : UITableViewCell?
    
    @IBOutlet var tableView : UITableView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }
    
    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)
    
        reloadData()
    }
    
    
    func reloadData() {
        todoObjects = Todo.MR_findAll()
        tableView.reloadData()
    }
    
    
    @IBAction func didTouchAddButton(sender : AnyObject) {
        let sampleTodo: Todo = Todo.MR_createEntity() as Todo   // エンティティーを作成する
        sampleTodo.title = "title: \(NSDate.date())"            // 日付をタイトルにセット
        sampleTodo.deadline = NSDate.date()                    // 現在時刻をセット
        // CoreDataに保存する(永続化)
        sampleTodo.managedObjectContext.MR_saveToPersistentStoreAndWait()
        reloadData()
    }
    
    
    func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
        println("numberOfRowsInSection")
        return todoObjects.count
    }
    
    func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
        println("cellForRowAtIndexPath path:\(indexPath)")
        let cell: UITableViewCell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "TodoCell")
    
        cell.textLabel.text = todoObjects[indexPath.row].title
        cell.detailTextLabel.text = "\(todoObjects[indexPath.row].deadline)"
    
        return cell
    }
    
    func tableView(tableView: UITableView!, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath!) {
    
        if editingStyle == UITableViewCellEditingStyle.Delete {
            // Entityの削除
            let todoObject: Todo = todoObjects[indexPath.row] as Todo
            todoObject.MR_deleteEntity()
    
            todoObject.managedObjectContext.MR_saveToPersistentStoreAndWait()
    
            todoObjects = Todo.MR_findAll()
            tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: UITableViewRowAnimation.Fade)
        }
    }
    
    func tableView(tableView: UITableView!, editingStyleForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCellEditingStyle {
    
        return UITableViewCellEditingStyle.Delete;
    }
    
    
    func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!) {
        //let selectedCell : UITableViewCell = tableView.cellForRowAtIndexPath(indexPath)
        selectedCell = tableView.cellForRowAtIndexPath(indexPath)
        indexPathForCell = indexPath
        self.performSegueWithIdentifier("toDetailView", sender: indexPath)
    
    }
    
    override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
        println("segue")
        if segue.identifier == "toDetailView" {
            segue.destinationViewController
            var detailView : DetailViewController = segue!.destinationViewController as DetailViewController
            detailView.selectedCell = selectedCell
    
            if let tmpTitle : String? = todoObjects[indexPathForCell!.row].title {
                detailView.titleText = todoObjects[indexPathForCell!.row].title
            }
    
            detailView.dateText = "\(todoObjects[indexPathForCell!.row].deadline)"
    
            if let tmpTag :String? = todoObjects[indexPathForCell!.row].tag {
                detailView.tagText = tmpTag
            }
            if let tmpMemo : String? = todoObjects[indexPathForCell!.row].memo {
                detailView.memoText = tmpMemo
            }
        }
    
    
    }
    
    override func di

    //
    // DetailViewController.swift
    // SwiftTodo
    //
    // Created by Hirotoki on 2014/07/26.
    // Copyright (c) 2014年 exilias. All rights reserved.
    //

    import UIKit

    class DetailViewController: UIViewController {

    //@IBOutlet var backButton : UIButton?
    @IBOutlet var imageView : UIImageView?
    @IBOutlet var cellTitle : UILabel?
    @IBOutlet var cellDate : UILabel?
    @IBOutlet var cellTag : UILabel?
    @IBOutlet var cellMemo : UITextView?
    
    @IBAction func backToListPage(sender: AnyObject) {
        self.dismissViewControllerAnimated(true, completion: nil)
    }
    
    var selectedCell : UITableViewCell?
    var indexPath : NSIndexPath?
    var titleText : String?
    var dateText : String?
    var tagText : String?
    var memoText : String?
    var img : UIImage?
    
    override func viewDidLoad() {
        super.viewDidLoad()
    
        img = UIImage(named: "icon")
        if img {
            imageView!.image = img
        }
        if titleText {
            cellTitle!.text = titleText
        }
        if dateText {
            cellDate!.text = dateText
        }
        if tagText {
            cellTag!.text = tagText
        }
        if memoText {
            cellMemo!.text = memoText
        }
        // Do any additional setup after loading the view.
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    
    
    /*
    // MARK: - Navigation
    
    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

    }

    yutaka juba
    @yutaka-j

    Swiftハッカソンの成果物になります。

    作成したアプリ:
    ボスに怒られるまで(サボるのを辞めない)

    説明:
    ボスに怒られないように、TODOを管理するためのアプリ。
    TODOを登録すると、最も締め切りが近いTODOまでの時間をカウントダウンします。

    title Swiftハッカソン_チーム4
    Punita Ojha
    @punitaojha
    This message was deleted