Lo-oker
Lo-oker

Reputation: 21

public shows redundant visibility modifier in kotlin

I got a warning message on the public to indicate that its a redundant visibility modifier. Actually I call the function in different classes. Written kotlin.

public fun makeCurrentFragmentAnimLtRl(fragment: Fragment) {
            supportFragmentManager.beginTransaction().apply {
                setCustomAnimations(R.animator.slide_in_left, R.animator.slide_out_left,
                    0, 0)
                replace(R.id.cl_wrapper, fragment)
                commit()
            }
        }

Upvotes: 1

Views: 1502

Answers (1)

Sergio
Sergio

Reputation: 30665

In Kotlin the default visibility, used if there is no explicit modifier, is public. You receive the warning from IDE "Redundant visibility modifier" because you can omit it.

Just write fun makeCurrentFragmentAnimLtRl(fragment: Fragment) {...} and the method will be public by default.

Upvotes: 3

Related Questions