How to select a specified date by code in FSCalendar

Overview

-Select on the specified date when the screen changes with FS Calendar. ・ I was having trouble specifying the date at the screen transition destination, so I will write it in Qiita.

code

ViewController.swift



@IBOutlet weak var calView: FSCalendar!


override func viewWillAppear(_ animated: Bool) {
            
    let calPosition = Calendar.current
    //The date specified here is an Int type
    let selectDay = calPosition.date(from: DateComponents(year: 2020, month: 11, day: 5))
    calView.select(selectDay)
}

Supplement

-Date specified in Date Components is Int type -I am casting to Int because the value obtained on another screen is String. -It is written in Int type for easy viewing.

Recommended Posts

How to select a specified date by code in FSCalendar
How to display a browser preview in VS Code
How to write a date comparison search in Rails
How to create a form to select a date from the calendar
How to get date data in Ruby
How to insert a video in Rails
How to get the date in java
How to publish a library in jCenter
How to implement a slideshow using slick in Rails (one by one & multiple by one)
[Rails] How to log in with a name by adding a devise name column
How to get the current date as a string in yyyyMMdd format
Summary of how to select elements in Selenium
How to color code console output in Eclipse
[Rails] How to use select boxes in Ransack
Code to escape a JSON string in Java
How to run a djUnit task in Ant
How to add a classpath in Spring Boot
How to create a theme in Liferay 7 / DXP
How to separate .scss by controller in Rails
How to implement a like feature in Rails
How to easily create a pull-down in Rails
How to make a follow function in Rails
How to automatically generate a constructor in Eclipse
How to output jar with main class specified by gradle in Intellij IDEA
How to implement UICollectionView in Swift with code only
How to clear all data in a particular table
How to create a Java environment in just 3 seconds
How to implement a like feature in Ajax in Rails
How to create a Spring Boot project in IntelliJ
How to create a data URI (base64) in Java
[Java] How to get a request by HTTP communication
How to launch another command in a Ruby program
How to store Rakuten API data in a table
How to mock a super method call in PowerMock
[Java] How to cut out a character string character by character
How to convert A to a and a to A using AND and OR in Java
How to convert a file to a byte array in Java
[Rails 6] How to set a background image in Rails [CSS]
[Rails] How to load JavaScript in a specific view
How to write a core mod in Minecraft Forge 1.15.2
[Ruby/Rails] How to generate a password in a regular expression
How to specify character code and line feed code in JAXB
How to write good code
A memorandum when I investigated how to convert from Epoch Time to Date type in Scala
How to write a migration from Rails datetime type to date type
How to connect the strings in the List separated by commas
How to change a string in an array to a number in Ruby
How to leave a comment
How to create a placeholder part to use in the IN clause
How to set character code and line feed code in Eclipse
How to store a string from ArrayList to String in Java (Personal)
How to display a graph in Ruby on Rails (LazyHighChart)
How to add the same Indexes in a nested array
[Swift5] How to avoid applying dark mode (dark appearance) in code
Mapping to a class with a value object in How to MyBatis
How to develop and register a Sota app in Java
How to simulate uploading a post-object form to OSS in Java
How to disable existing selected items in the select box
How to create a service builder portlet in Liferay 7 / DXP
How to insert a video
How to set up a proxy with authentication in Feign