You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
769 B
27 lines
769 B
//
|
|
// SegmentViewController.swift
|
|
// SwiftUI_Jike
|
|
//
|
|
// Created by alexyang on 2019/6/6.
|
|
// Copyright © 2019 alexyang. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
import SwiftUI
|
|
|
|
struct SegmentViewController : UIViewControllerRepresentable {
|
|
var controllers: [UIViewController]
|
|
func makeUIViewController(context: Context) -> UIPageViewController {
|
|
let pageViewController = UIPageViewController(
|
|
transitionStyle: .scroll,
|
|
navigationOrientation: .horizontal)
|
|
|
|
return pageViewController
|
|
}
|
|
|
|
func updateUIViewController(_ pageViewController: UIPageViewController, context: Context) {
|
|
pageViewController.setViewControllers(
|
|
[controllers[0]], direction: .forward, animated: true)
|
|
}
|
|
|
|
}
|
|
|