This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* アルバム一覧用のコンポーネント | |
*/ | |
import React, { Component } from 'react'; | |
import { ScrollView } from 'react-native'; | |
//HTTP通信用のライブラリ'axios'のインポート宣言 | |
import axios from 'axios'; | |
//アルバム詳細用の共通コンポーネントのインポート宣言 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* アプリコンテンツ用のコンポーネント | |
*/ | |
import React, { Component } from 'react'; | |
//react-native-router-fluxのインポート宣言(Actionを使用) | |
import { Router, Scene } from 'react-native-router-flux'; | |
//自作コンポーネント |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
import SwiftyJSON | |
struct Article { | |
//メンバ変数(取得したJSONレスポンスのKeyに対応する値が入る) | |
let id: Int | |
let thumbnailUrl: String | |
let title: String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import UIKit | |
class FlipDismissCustomTransition: NSObject { | |
//トランジション(実行)の秒数 | |
fileprivate let duration: TimeInterval = 0.72 | |
//ディレイ(遅延)の秒数 | |
fileprivate let delay: TimeInterval = 0.00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func viewWillAppear(_ animated: Bool) { | |
super.viewWillAppear(animated) | |
if let navigationController = navigationController as? ScrollingNavigationController { | |
navigationController.followScrollView(articleTableView, delay: 44.0) | |
//MEMO: ScrollingNavigationControllerDelegateを利用する際に必要な宣言 | |
//navigationController.scrollingNavbarDelegate = self | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public struct CalculateCalendarLogic { | |
/** | |
* | |
* 祝日になる日を判定する | |
* (引数) year: Int, month: Int, day: Int, weekdayIndex: Int | |
* weekdayIndexはWeekdayのenumに該当する値(0...6)が入る | |
* ※1. カレンダーロジックの参考:http://p-ho.net/index.php?page=2s2 | |
* ※2. 書き方(タプル)の参考:http://blog.kitoko552.com/entry/2015/06/17/213553 | |
* ※3. [Swift] 関数における引数/戻り値とタプルの関係:http://dev.classmethod.jp/smartphone/swift-function-tupsle/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 楽天レシピ別カテゴリランキングのAPIキー ※各自取得をお願いします。 | |
static let API_KEY_RAKUTEN_RECIPE_RANKING = "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import Alamofire | |
import PromiseKit | |
import SwiftyJSON | |
class APIManagerForNewYorkTimes { | |
private let baseUrl = "https://api.nytimes.com/svc/search/v2/articlesearch.json" | |
private let key = Constants.NEWYORKTIMES_API_KEY | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
// React-Reduxのインポート宣言 → ProviderタグでラップすることでReactコンポーネント内でStoreにアクセスできるようにする | |
import { Provider } from 'react-redux'; | |
// createStore, applyMiddlewareのインポート宣言 | |
import { createStore, applyMiddleware } from 'redux'; | |
// redux-thunkのインポート宣言 | |
import ReduxThunk from 'redux-thunk'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// その1: APIサーバーとの通信処理(JSONレスポンス取得) | |
/** | |
* APIへの通信処理: | |
* method: .get または .post | |
* parameters: [String : Any] 例. ["key" : value] | |
* encoding: JSONEncoding.default (パラメーターがない場合は不要) | |
* headers: [String : Any] 例. ["key" : value] (認可等が必要なユーザーのデータへアクセスしたい場合は必要) | |
*/ |