{"id":474,"date":"2020-09-04T10:58:18","date_gmt":"2020-09-04T01:58:18","guid":{"rendered":"https:\/\/naoya-ono.com\/swift\/?p=474"},"modified":"2020-09-15T12:43:39","modified_gmt":"2020-09-15T03:43:39","slug":"swift-uipageviewcontroller","status":"publish","type":"post","link":"https:\/\/naoya-ono.com\/swift\/swift-uipageviewcontroller\/","title":{"rendered":"\u3010Swift\u3011UIPageViewController\u306e\u4f7f\u3044\u65b9\u307e\u3068\u3081"},"content":{"rendered":"<p>\u3053\u306e\u30da\u30fc\u30b8\u3067\u306fiOS\u30a2\u30d7\u30ea\u958b\u767a\u521d\u5fc3\u8005\u5411\u3051\u306bUIPageViewController\u306e\u4f7f\u3044\u65b9\u3092\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n<p>UIPageViewController\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u4e0b\u306e\u52d5\u753b\u306e\u3088\u3046\u306b\u753b\u9762\u3092\u30b9\u30ef\u30a4\u30d7\u3059\u308b\u3053\u3068\u3067\u5225\u306eView\u3078\u79fb\u52d5\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<div class=\"youtube\">\n<p><iframe loading=\"lazy\" title=\"UI PageViewController\u306e\u52d5\u4f5c\" width=\"880\" height=\"495\" src=\"https:\/\/www.youtube.com\/embed\/TwxRqqOBd9Q?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<\/div>\n<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">Contents<\/p><ul class=\"toc_list\"><li><a href=\"#i\">\u5b9f\u88c5\u307e\u3067\u306e\u6d41\u308c<\/a><\/li><li><a href=\"#STEP1_ViewController\">STEP1. \u30b9\u30af\u30ed\u30fc\u30eb\u3067\u753b\u9762\u9077\u79fb\u3055\u305b\u305f\u3044ViewController\u306e\u6e96\u5099<\/a><\/li><li><a href=\"#STEP2_UIPageViewController\">STEP2. UIPageViewController\u306e\u6e96\u5099<\/a><\/li><li><a href=\"#STEP3\">STEP3. \u30b3\u30fc\u30c9\u3092\u8a18\u8ff0<\/a><\/li><\/ul><\/div>\n<h2 class=\"hh hh5 pastel-bc\" id=\"i-0\"><span id=\"i\">\u5b9f\u88c5\u307e\u3067\u306e\u6d41\u308c<\/span><\/h2>\n<div class=\"sng-box box5\">\n<div class=\"ol-circle li-accentbdr acc-bc-before\">\n<ol>\n<li><span>\u30b9\u30af\u30ed\u30fc\u30eb\u3067\u753b\u9762\u9077\u79fb\u3055\u305b\u305f\u3044ViewController\u306e\u6e96\u5099<\/span><\/li>\n<li>UIPageViewController\u306e\u6e96\u5099<\/li>\n<li>\u30b3\u30fc\u30c9\u3092\u8a18\u8ff0<\/li>\n<\/ol>\n<\/div>\n<\/div>\n<p><script src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\" async><\/script><br \/>\n<ins class=\"adsbygoogle\" style=\"display: block; text-align: center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-4166043434922569\" data-ad-slot=\"7750996733\"><\/ins><br \/>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script><\/p>\n<h2 class=\"hh hh5 pastel-bc\" id=\"i-1\"><span id=\"STEP1_ViewController\">STEP1. <span>\u30b9\u30af\u30ed\u30fc\u30eb\u3067\u753b\u9762\u9077\u79fb\u3055\u305b\u305f\u3044ViewController\u306e\u6e96\u5099<\/span><\/span><\/h2>\n<p>\u307e\u305a\u306f\u3001\u30b9\u30af\u30ed\u30fc\u30eb\u3067\u8868\u793a\u3059\u308bViewController\u3092storyboard\u3067\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\uff13\u3064\uff08FirstView\u3001SecondView\u3001ThirdView\uff09\u7528\u610f\u3057\u307e\u3057\u305f\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic1.png\" alt=\"\" width=\"1024\" height=\"462\" class=\"alignnone wp-image-482 size-full\" srcset=\"https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic1.png 1024w, https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic1-300x135.png 300w, https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic1-768x347.png 768w, https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic1-940x424.png 940w\" sizes=\"(max-width: 1024px) 100vw, 1024px\"><\/p>\n<p>ViewController\u3092\u8ffd\u52a0\u3057\u305f\u3089\u3001\u30af\u30e9\u30b9\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3001\u305d\u308c\u305e\u308c\u306eViewController\u306b\u5272\u308a\u5f53\u3066\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306fFirstViewController\u3001SecondViewController\u3001hirdViewController\u3068\u3044\u3046\u540d\u524d\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3001\u5272\u308a\u5f53\u3066\u307e\u3057\u305f\u3002<\/p>\n<p>\u307e\u305f\u3001\u3053\u306e\u6642<strong>Storyboard ID<\/strong>\u306b\u540d\u524d\u306f\u4f55\u3067\u3082\u3044\u3044\u306e\u3067\u3001\u4e00\u610f\u306eID\u3092\u767b\u9332\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u308f\u304b\u308a\u3084\u3059\u3044\u3088\u3046\u306bFirstView\u3001SecondView\u3001ThirdView\u3068\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic2.jpg\" alt=\"\" width=\"321\" height=\"296\" class=\"alignnone wp-image-481 \" srcset=\"https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic2.jpg 520w, https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic2-300x277.jpg 300w\" sizes=\"(max-width: 321px) 100vw, 321px\"><\/p>\n<p>\u3053\u3053\u307e\u3067\u3092\u307e\u3068\u3081\u308b\u3068\u3001\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<table style=\"border-collapse: collapse; width: 100%; height: 156px;\">\n<tbody>\n<tr style=\"height: 39px; background-color: #3d3d3d;\">\n<td style=\"width: 26.8541%; height: 39px;\"><span style=\"color: #ffffff;\">ViewController<\/span><\/td>\n<td style=\"width: 32.0458%; height: 39px;\"><span style=\"color: #ffffff;\">Class<\/span><\/td>\n<td style=\"width: 41.1001%; height: 39px;\"><span style=\"color: #ffffff;\">Storyboard ID<\/span><\/td>\n<\/tr>\n<tr style=\"height: 39px;\">\n<td style=\"width: 26.8541%; height: 39px;\">FirstView<\/td>\n<td style=\"width: 32.0458%; height: 39px;\">FirstViewController<\/td>\n<td style=\"width: 41.1001%; height: 39px;\">FirstView<\/td>\n<\/tr>\n<tr style=\"height: 39px;\">\n<td style=\"width: 26.8541%; height: 39px;\">SecondView<\/td>\n<td style=\"width: 32.0458%; height: 39px;\">SecondViewController<\/td>\n<td style=\"width: 41.1001%; height: 39px;\">SecondView<\/td>\n<\/tr>\n<tr style=\"height: 39px;\">\n<td style=\"width: 26.8541%; height: 39px;\">ThirdView<\/td>\n<td style=\"width: 32.0458%; height: 39px;\">ThirdViewController<\/td>\n<td style=\"width: 41.1001%; height: 39px;\">ThirdView<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 class=\"hh hh5 pastel-bc\" id=\"i-2\"><span id=\"STEP2_UIPageViewController\">STEP2. UIPageViewController\u306e\u6e96\u5099<\/span><\/h2>\n<p>\u4eca\u306e\u6bb5\u968e\u3067\u306f\u5358\u306bView Controller\u3092\u7528\u610f\u3057\u305f\u3060\u3051\u3067\u3059\u306e\u3067\u3001\u4eca\u5ea6\u306f\u3053\u308c\u3089\u3092\u30b9\u30af\u30ed\u30fc\u30eb\u3067\u753b\u9762\u5207\u308a\u66ff\u3048\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u305d\u306e\u5f79\u5272\u3092\u62c5\u3046\u306e\u304c<strong>UIPageViewController<\/strong>\u3067\u3059\u3002<\/p>\n<p>\u4eca\u5ea6\u306f\u3053\u3061\u3089\u3092\u6e96\u5099\u3057\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u307e\u305a\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u7528\u610f\u3055\u308c\u3066\u3044\u308bView Controller\u306f\u4e0d\u8981\u306a\u306e\u3067\u524a\u9664\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic3.jpg\" alt=\"\" width=\"1024\" height=\"529\" class=\"wp-image-480 size-full aligncenter\" srcset=\"https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic3.jpg 1024w, https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic3-300x155.jpg 300w, https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic3-768x397.jpg 768w, https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic3-940x486.jpg 940w\" sizes=\"(max-width: 1024px) 100vw, 1024px\"><\/p>\n<p>\u524a\u9664\u3057\u305f\u3089\u3001\u300cPage View Controller\u300d\u3092storyboard\u4e0a\u306b\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic4.jpg\" alt=\"\" width=\"1024\" height=\"460\" class=\"wp-image-479 size-full aligncenter\" srcset=\"https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic4.jpg 1024w, https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic4-300x135.jpg 300w, https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic4-768x345.jpg 768w, https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic4-940x422.jpg 940w\" sizes=\"(max-width: 1024px) 100vw, 1024px\"><\/p>\n<p>\u8ffd\u52a0\u3057\u305fPage View Controller\u306e<strong>is Initial View Controller\u306b\u30c1\u30a7\u30c3\u30af\u3092\u3064\u3051\uff08\u753b\u50cf\u306e\u2460\uff09\u3001Transition Style\u3092\u300cScroll\u300d\u306b\u3057\u3066\u304f\u3060\u3055\u3044\uff08\u753b\u50cf\u306e\u2461\uff09\u3002<\/strong><\/p>\n<p>is Initial View Controller\u306f\u30a2\u30d7\u30ea\u3092\u8d77\u52d5\u3057\u3066\u6700\u521d\u306b\u547c\u3070\u308c\u308bView Controller\u3067\u3059\u306d\u3002<\/p>\n<p>\u5148\u307b\u3069\u3001\u30c7\u30d5\u30a9\u30eb\u30c8\u306eView Controller\u3092\u524a\u9664\u3057\u305f\u3042\u306e\u3067\u3001\u65b0\u3057\u304f\u8ffd\u52a0\u3057\u305fPage View Controller\u3092\u6700\u521d\u306b\u547c\u3076View Controller\u3068\u3057\u3066\u8a2d\u5b9a\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic5.jpg\" alt=\"\" width=\"1024\" height=\"483\" class=\"wp-image-478 size-full aligncenter\" srcset=\"https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic5.jpg 1024w, https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic5-300x142.jpg 300w, https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic5-768x362.jpg 768w, https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic5-940x443.jpg 940w\" sizes=\"(max-width: 1024px) 100vw, 1024px\"><br \/>\n<script src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\" async><\/script><br \/>\n<ins class=\"adsbygoogle\" style=\"display: block; text-align: center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-4166043434922569\" data-ad-slot=\"7750996733\"><\/ins><br \/>\n<script>\n     (adsbygoogle = window.adsbygoogle || []).push({});\n<\/script><\/p>\n<h2 class=\"hh hh5 pastel-bc\" id=\"i-3\"><span id=\"STEP3\">STEP3. <span>\u30b3\u30fc\u30c9\u3092\u8a18\u8ff0<\/span><\/span><\/h2>\n<p>\u4eca\u306e\u6bb5\u968e\u3067\u306f\u3001UIPageViewController\u306e\u8ffd\u52a0\u306f\u3057\u307e\u3057\u305f\u304c\u3001FirstView\u301cThirdView\u3068\u306e\u95a2\u9023\u306f\u4f55\u3082\u3042\u308a\u307e\u305b\u3093\u306d\u3002<\/p>\n<p>\u305d\u306e\u305f\u3081\u3001\u3053\u308c\u3089\u306eViewController\u3092\u95a2\u9023\u4ed8\u3051\u3092\u884c\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u306f\u3001UIPageViewController\u7528\u306e\u30af\u30e9\u30b9\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<p>\u30d5\u30a1\u30a4\u30eb\u540d\u306f\u4eca\u56de\u300cPageViewController\u300d\u3068\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u300cSubclass of:\u300d\u3067\u306f\u300cUIPageViewController\u300d\u3092\u9078\u3093\u3067\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic6.jpg\" alt=\"\" width=\"536\" height=\"387\" class=\"alignnone wp-image-477 \" srcset=\"https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic6.jpg 1024w, https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic6-300x217.jpg 300w, https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic6-768x554.jpg 768w, https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic6-940x678.jpg 940w\" sizes=\"(max-width: 536px) 100vw, 536px\"><\/p>\n<p>\u30d5\u30a1\u30a4\u30eb\u304c\u8ffd\u52a0\u3067\u304d\u305f\u3089\u3001\u5148\u307b\u3069\u8ffd\u52a0\u3057\u305fUIPageViewController\u306b\u30af\u30e9\u30b9\u30d5\u30a1\u30a4\u30eb\u3092\u5272\u308a\u5f53\u3066\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic7.jpg\" alt=\"\" width=\"1024\" height=\"489\" class=\"wp-image-476 size-full aligncenter\" srcset=\"https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic7.jpg 1024w, https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic7-300x143.jpg 300w, https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic7-768x367.jpg 768w, https:\/\/naoya-ono.com\/swift\/wp-content\/uploads\/2020\/09\/UIPageViewController_basic7-940x449.jpg 940w\" sizes=\"(max-width: 1024px) 100vw, 1024px\"><\/p>\n<p>\u6700\u5f8c\u306b\u4ed6\u306eViewController\uff08FirstView\u301cThirdView\uff09\u3068\u95a2\u9023\u4ed8\u3051\u3092\u884c\u3046\u305f\u3081\u306bPageViewController.swift\u306b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-swift\" data-lang=\"Swift\"><code>import UIKit\n\nclass PageViewController: UIPageViewController {&nbsp;&nbsp; &nbsp;\n\n&nbsp; &nbsp; \/\/ \u2460 PageView\u4e0a\u3067\u8868\u793a\u3059\u308bViewController\u3092\u7ba1\u7406\u3059\u308b\u914d\u5217\n&nbsp; &nbsp; private var controllers: [UIViewController] = []\n&nbsp;&nbsp; &nbsp;\n&nbsp; &nbsp; override func viewDidLoad() {\n&nbsp; &nbsp; &nbsp; &nbsp; super.viewDidLoad()&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;\n\n&nbsp; &nbsp; &nbsp; &nbsp; \/\/ \u2461\u521d\u671f\u5316\n&nbsp; &nbsp; &nbsp; &nbsp; self.initPageView()\n&nbsp; &nbsp; }\n&nbsp;&nbsp; &nbsp;\n&nbsp; &nbsp; \/\/ \u2461\u521d\u671f\u5316\uff08PageView\u3067\u8868\u793a\u3059\u308bView\u3092\u30bb\u30c3\u30c8\uff09\n&nbsp; &nbsp; func initPageView(){&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;\n&nbsp; &nbsp; &nbsp; &nbsp; \/\/ PageViewController\u3067\u8868\u793a\u3059\u308bViewController\u3092\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\n&nbsp; &nbsp; &nbsp; &nbsp; let firstVC = storyboard!.instantiateViewController(withIdentifier: \"FirstView\") as! FirstViewController\n&nbsp; &nbsp; &nbsp; &nbsp; let secondVC = storyboard!.instantiateViewController(withIdentifier: \"SecondView\") as! SecondViewController\n&nbsp; &nbsp; &nbsp; &nbsp; let ThirdVC = storyboard!.instantiateViewController(withIdentifier: \"ThirdView\") as! ThirdViewController\n\n&nbsp; &nbsp; &nbsp; &nbsp; \/\/ \u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\u3057\u305fViewController\u3092\u914d\u5217\u306b\u8ffd\u52a0\n&nbsp; &nbsp; &nbsp; &nbsp; self.controllers = [ firstVC, secondVC, ThirdVC ]&nbsp; &nbsp; &nbsp;\n\n&nbsp; &nbsp; &nbsp; &nbsp; \/\/ \u6700\u521d\u306b\u8868\u793a\u3059\u308bViewController\u3092\u6307\u5b9a\u3059\u308b\n&nbsp; &nbsp; &nbsp; &nbsp; setViewControllers([self.controllers[0]],\n&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; direction: .forward,\n&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; animated: true,\n&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; completion: nil) &nbsp; &nbsp;\n\n&nbsp; &nbsp; &nbsp; &nbsp; \/\/ PageViewController\u306eDataSource\u3068\u306e\u95a2\u9023\u4ed8\u3051\n&nbsp; &nbsp; &nbsp; &nbsp; self.dataSource = self\n&nbsp; &nbsp; }\n}\n\n\/\/ MARK: - UIPageViewController DataSource\nextension PageViewController: UIPageViewControllerDataSource {&nbsp;&nbsp; &nbsp;\n&nbsp; &nbsp; \/\/ \u30b9\u30af\u30ed\u30fc\u30eb\u3059\u308b\u30da\u30fc\u30b8\u6570\n&nbsp; &nbsp; func presentationCount(for pageViewController: UIPageViewController) -&gt; Int {\n&nbsp; &nbsp; &nbsp; &nbsp; return self.controllers.count\n&nbsp; &nbsp; }\n\n&nbsp; &nbsp; \/\/ \u5de6\u306b\u30b9\u30ef\u30a4\u30d7\u3057\u305f\u6642\u306e\u51e6\u7406\n&nbsp; &nbsp; func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -&gt; UIViewController? {\n&nbsp; &nbsp; &nbsp; &nbsp; if let index = self.controllers.firstIndex(of: viewController),\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; index &lt; self.controllers.count - 1 {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return self.controllers[index + 1]\n&nbsp; &nbsp; &nbsp; &nbsp; } else {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return nil\n&nbsp; &nbsp; &nbsp; &nbsp; }\n&nbsp; &nbsp; }\n&nbsp;&nbsp; &nbsp;\n&nbsp; &nbsp; \/\/ \u53f3\u306b\u30b9\u30ef\u30a4\u30d7\u3057\u305f\u6642\u306e\u51e6\u7406\n&nbsp; &nbsp; func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -&gt; UIViewController? {\n&nbsp; &nbsp; &nbsp; &nbsp; if let index = self.controllers.firstIndex(of: viewController),\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; index &gt; 0 {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return self.controllers[index - 1]\n&nbsp; &nbsp; &nbsp; &nbsp; } else {\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return nil\n&nbsp; &nbsp; &nbsp; &nbsp; }\n&nbsp; &nbsp; }&nbsp;&nbsp; &nbsp;\n}<\/code><\/pre>\n<\/div>\n<p>PageViewController\u306e\u521d\u671f\u5316\u51e6\u7406\u300cinitPageView()\u300d\u306e\u4e2d\u3067\u3001\u6b21\u306e\u3088\u3046\u306b\u8868\u793a\u3059\u308bViewController\u3092\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-swift\" data-lang=\"Swift\"><code>let firstVC = storyboard!.instantiateViewController(withIdentifier: \"FirstView\") as! FirstViewController\nlet secondVC = storyboard!.instantiateViewController(withIdentifier: \"SecondView\") as! SecondViewController\nlet ThirdVC = storyboard!.instantiateViewController(withIdentifier: \"ThirdView\") as! ThirdViewController<\/code><\/pre>\n<\/div>\n<p>\u3042\u306a\u305f\u306e\u74b0\u5883\u306b\u5408\u308f\u305b\u3066\u3001withIdentifier\u306b\u306fStoryboard ID\u306e\u5024\u3092\u8a2d\u5b9a\u3057\u3001as!\uff08\u30c0\u30a6\u30f3\u30ad\u30e3\u30b9\u30c8\uff09\u3067\u3001ViewController\u540d\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u4ee5\u4e0a\u3067\u3001\u30d3\u30eb\u30c9\u3057\u52d5\u4f5c\u3092\u78ba\u8a8d\u3059\u308b\u3068\u30b9\u30ef\u30a4\u30d7 \u3067\u753b\u9762\u306e\u5207\u308a\u66ff\u3048\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<div id=\"rinkerid180\" class=\"yyi-rinker-contents  yyi-rinker-postid-180 yyi-rinker-img-m yyi-rinker-catid-5 yyi-rinker-catid-15 \">\n<div class=\"yyi-rinker-box\">\n<div class=\"yyi-rinker-image\">\n\t\t\t\t\t\t\t<a href=\"https:\/\/www.amazon.co.jp\/dp\/B086VVQ3DJ?tag=naoya-ono-22&amp;linkCode=ogi&amp;th=1&amp;psc=1\" rel=\"nofollow\" class=\"yyi-rinker-tracking\" data-click-tracking=\"amazon_img 180 \uff3b\u5897\u88dc\u6539\u8a02\u7b2c3\u7248\uff3dSwift\u5b9f\u8df5\u5165\u9580 \u2500\u2500 \u76f4\u611f\u7684\u306a\u6587\u6cd5\u3068\u5b89\u5168\u6027\u3092\u517c\u306d\u5099\u3048\u305f\u8a00\u8a9e WEB+DB PRESS plus\" data-vars-click-id=\"amazon_img 180 \uff3b\u5897\u88dc\u6539\u8a02\u7b2c3\u7248\uff3dSwift\u5b9f\u8df5\u5165\u9580 \u2500\u2500 \u76f4\u611f\u7684\u306a\u6587\u6cd5\u3068\u5b89\u5168\u6027\u3092\u517c\u306d\u5099\u3048\u305f\u8a00\u8a9e WEB+DB PRESS plus\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/m.media-amazon.com\/images\/I\/51iY70Z3fKL._SL160_.jpg\" width=\"113\" height=\"160\" class=\"yyi-rinker-main-img\" style=\"border: none;\"><\/a>\t\t\t\t\t<\/div>\n<div class=\"yyi-rinker-info\">\n<div class=\"yyi-rinker-title\">\n\t\t\t\t\t\t\t\t\t<a href=\"https:\/\/www.amazon.co.jp\/dp\/B086VVQ3DJ?tag=naoya-ono-22&amp;linkCode=ogi&amp;th=1&amp;psc=1\" rel=\"nofollow\" class=\"yyi-rinker-tracking\" data-click-tracking=\"amazon_title 180 \uff3b\u5897\u88dc\u6539\u8a02\u7b2c3\u7248\uff3dSwift\u5b9f\u8df5\u5165\u9580 \u2500\u2500 \u76f4\u611f\u7684\u306a\u6587\u6cd5\u3068\u5b89\u5168\u6027\u3092\u517c\u306d\u5099\u3048\u305f\u8a00\u8a9e WEB+DB PRESS plus\" data-vars-amp-click-id=\"amazon_title 180 \uff3b\u5897\u88dc\u6539\u8a02\u7b2c3\u7248\uff3dSwift\u5b9f\u8df5\u5165\u9580 \u2500\u2500 \u76f4\u611f\u7684\u306a\u6587\u6cd5\u3068\u5b89\u5168\u6027\u3092\u517c\u306d\u5099\u3048\u305f\u8a00\u8a9e WEB+DB PRESS plus\">\uff3b\u5897\u88dc\u6539\u8a02\u7b2c3\u7248\uff3dSwift\u5b9f\u8df5\u5165\u9580 \u2500\u2500 \u76f4\u611f\u7684\u306a\u6587\u6cd5\u3068\u5b89\u5168\u6027\u3092\u517c\u306d\u5099\u3048\u305f\u8a00\u8a9e WEB+DB PRESS plus<\/a>\t\t\t\t\t\t\t<\/div>\n<div class=\"yyi-rinker-detail\">\n<div class=\"credit-box\">created by&nbsp;<a href=\"https:\/\/oyakosodate.com\/rinker\/\" rel=\"nofollow noopener\" target=\"_blank\">Rinker<\/a><\/div>\n<div class=\"price-box\">\n\t\t\t\t\t\t\t<\/div>\n<\/p><\/div>\n<ul class=\"yyi-rinker-links\">\n<li class=\"amazonkindlelink\">\n\t\t\t\t\t\t<a href=\"https:\/\/www.amazon.co.jp\/dp\/B086VVQ3DJ?tag=naoya-ono-22&amp;linkCode=ogi&amp;th=1&amp;psc=1\" rel=\"nofollow\" class=\"yyi-rinker-link yyi-rinker-tracking\" data-click-tracking=\"amazon_kindle 180 \uff3b\u5897\u88dc\u6539\u8a02\u7b2c3\u7248\uff3dSwift\u5b9f\u8df5\u5165\u9580 \u2500\u2500 \u76f4\u611f\u7684\u306a\u6587\u6cd5\u3068\u5b89\u5168\u6027\u3092\u517c\u306d\u5099\u3048\u305f\u8a00\u8a9e WEB+DB PRESS plus\" data-vars-amp-click-id=\"amazon_kindle 180 \uff3b\u5897\u88dc\u6539\u8a02\u7b2c3\u7248\uff3dSwift\u5b9f\u8df5\u5165\u9580 \u2500\u2500 \u76f4\u611f\u7684\u306a\u6587\u6cd5\u3068\u5b89\u5168\u6027\u3092\u517c\u306d\u5099\u3048\u305f\u8a00\u8a9e WEB+DB PRESS plus\">Kindle<\/a>\t\t\t\t\t<\/li>\n<li class=\"amazonlink\">\n\t\t\t\t\t\t<a href=\"https:\/\/www.amazon.co.jp\/dp\/B086VVQ3DJ?tag=naoya-ono-22&amp;linkCode=ogi&amp;th=1&amp;psc=1\" rel=\"nofollow\" class=\"yyi-rinker-link yyi-rinker-tracking\" data-click-tracking=\"amazon 180 \uff3b\u5897\u88dc\u6539\u8a02\u7b2c3\u7248\uff3dSwift\u5b9f\u8df5\u5165\u9580 \u2500\u2500 \u76f4\u611f\u7684\u306a\u6587\u6cd5\u3068\u5b89\u5168\u6027\u3092\u517c\u306d\u5099\u3048\u305f\u8a00\u8a9e WEB+DB PRESS plus\" data-vars-amp-click-id=\"amazon 180 \uff3b\u5897\u88dc\u6539\u8a02\u7b2c3\u7248\uff3dSwift\u5b9f\u8df5\u5165\u9580 \u2500\u2500 \u76f4\u611f\u7684\u306a\u6587\u6cd5\u3068\u5b89\u5168\u6027\u3092\u517c\u306d\u5099\u3048\u305f\u8a00\u8a9e WEB+DB PRESS plus\">Amazon<\/a>\t\t\t\t\t<\/li>\n<li class=\"rakutenlink\">\n\t\t\t\t\t\t<a href=\"https:\/\/hb.afl.rakuten.co.jp\/hgc\/16781883.64066d33.16781884.4f333982\/Rinker_o_20200831130951?pc=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2Fswift%2B%25E5%25AE%259F%25E8%25B7%25B5%25E5%2585%25A5%25E9%2596%2580%2F%3Ff%3D1%26grp%3Dproduct&amp;m=https%3A%2F%2Fsearch.rakuten.co.jp%2Fsearch%2Fmall%2Fswift%2B%25E5%25AE%259F%25E8%25B7%25B5%25E5%2585%25A5%25E9%2596%2580%2F%3Ff%3D1%26grp%3Dproduct\" rel=\"nofollow\" class=\"yyi-rinker-link yyi-rinker-tracking\" data-click-tracking=\"rakuten 180 \uff3b\u5897\u88dc\u6539\u8a02\u7b2c3\u7248\uff3dSwift\u5b9f\u8df5\u5165\u9580 \u2500\u2500 \u76f4\u611f\u7684\u306a\u6587\u6cd5\u3068\u5b89\u5168\u6027\u3092\u517c\u306d\u5099\u3048\u305f\u8a00\u8a9e WEB+DB PRESS plus\" data-vars-amp-click-id=\"rakuten 180 \uff3b\u5897\u88dc\u6539\u8a02\u7b2c3\u7248\uff3dSwift\u5b9f\u8df5\u5165\u9580 \u2500\u2500 \u76f4\u611f\u7684\u306a\u6587\u6cd5\u3068\u5b89\u5168\u6027\u3092\u517c\u306d\u5099\u3048\u305f\u8a00\u8a9e WEB+DB PRESS plus\">\u697d\u5929\u5e02\u5834<\/a>\t\t\t\t\t<\/li>\n<li class=\"yahoolink\">\n\t\t\t\t\t\t<a href=\"https:\/\/shopping.yahoo.co.jp\/search?p=swift+%E5%AE%9F%E8%B7%B5%E5%85%A5%E9%96%80\" rel=\"nofollow\" class=\"yyi-rinker-link yyi-rinker-tracking\" data-click-tracking=\"yahoo 180 \uff3b\u5897\u88dc\u6539\u8a02\u7b2c3\u7248\uff3dSwift\u5b9f\u8df5\u5165\u9580 \u2500\u2500 \u76f4\u611f\u7684\u306a\u6587\u6cd5\u3068\u5b89\u5168\u6027\u3092\u517c\u306d\u5099\u3048\u305f\u8a00\u8a9e WEB+DB PRESS plus\" data-vars-amp-click-id=\"yahoo 180 \uff3b\u5897\u88dc\u6539\u8a02\u7b2c3\u7248\uff3dSwift\u5b9f\u8df5\u5165\u9580 \u2500\u2500 \u76f4\u611f\u7684\u306a\u6587\u6cd5\u3068\u5b89\u5168\u6027\u3092\u517c\u306d\u5099\u3048\u305f\u8a00\u8a9e WEB+DB PRESS plus\">Yahoo\u30b7\u30e7\u30c3\u30d4\u30f3\u30b0<\/a>\t\t\t\t\t<\/li>\n<\/ul><\/div>\n<\/p><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u306e\u30da\u30fc\u30b8\u3067\u306fiOS\u30a2\u30d7\u30ea\u958b\u767a\u521d\u5fc3\u8005\u5411\u3051\u306bUIPageViewController\u306e\u4f7f\u3044\u65b9\u3092\u89e3\u8aac\u3057\u307e\u3059\u3002 UIPageViewController\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u4e0b\u306e\u52d5\u753b\u306e\u3088\u3046\u306b\u753b\u9762\u3092\u30b9\u30ef\u30a4\u30d7\u3059\u308b\u3053\u3068\u3067\u5225\u306eView\u3078\u79fb\u52d5\u3067 &#8230; <\/p>\n","protected":false},"author":1,"featured_media":484,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,15],"tags":[],"_links":{"self":[{"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/posts\/474"}],"collection":[{"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/comments?post=474"}],"version-history":[{"count":3,"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/posts\/474\/revisions"}],"predecessor-version":[{"id":485,"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/posts\/474\/revisions\/485"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/media\/484"}],"wp:attachment":[{"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/media?parent=474"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/categories?post=474"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/naoya-ono.com\/swift\/wp-json\/wp\/v2\/tags?post=474"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}